host: Don't add nanopb generator if it exists
This checks if the project has already set the nanopb protobuf generator
before adding it as part of the host target.
Change-Id: Ie3642e98bf3d7d2d50bbd15eafa0d858e8487419
diff --git a/targets/host/target_toolchains.gni b/targets/host/target_toolchains.gni
index aeee7a2..20c10a3 100644
--- a/targets/host/target_toolchains.gni
+++ b/targets/host/target_toolchains.gni
@@ -33,7 +33,9 @@
pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio"
# Allow nanopb to be toggled via a build arg on host for easy testing.
- if (dir_pw_third_party_nanopb != "") {
+ _has_nanopb = pw_protobuf_GENERATORS + [ "nanopb" ] - [ "nanopb" ] !=
+ pw_protobuf_GENERATORS
+ if (dir_pw_third_party_nanopb != "" && !_has_nanopb) {
pw_protobuf_GENERATORS += [ "nanopb" ]
}