---
url: /examples/cpp/protobuf.md
---
## Using c library

We can also set `proto_public = true` to export the proto's header search directory and make it available for other parent targets to inherit from.

```lua
    add_packages("protobuf-c", {public = true})
    add_files("src/**.proto", {proto_public = true})
```

::: tip NOTE
Since the headers generated by protobuf reference the headers of the protobuf-c package, we also need to mark the package headers as `{public = true}` to export it.
:::

## Using the C++ library

We can also set `proto_public = true` to export the proto's header search directory and make it available for other parent targets to inherit from.

```lua
    add_packages("protobuf-cpp", {public = true})
    add_files("src/**.proto", {proto_public = true})
```

::: tip NOTE
Since the headers generated by protobuf reference the headers of the protobuf-cpp package, we also need to mark the package headers as `{public = true}` to export it.
:::
