From dd86fc38eb5e3874a0e41e74e8a436b6a69c6601 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 22 Sep 2023 18:16:51 +0200 Subject: [PATCH] fixup cpp.cmake PROTO_DIRS is used by python/dotnet/java cmake file too --- cmake/cpp.cmake | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmake/cpp.cmake b/cmake/cpp.cmake index f3180b10aeb..4d8478c95ab 100644 --- a/cmake/cpp.cmake +++ b/cmake/cpp.cmake @@ -129,6 +129,16 @@ endif() ################## ## PROTO FILE ## ################## +# Get Protobuf include dir +set(PROTO_DIRS) +get_target_property(protobuf_dirs protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) +foreach(dir IN LISTS protobuf_dirs) + if (NOT "${dir}" MATCHES "INSTALL_INTERFACE|-NOTFOUND") + #message(STATUS "Adding proto path: ${dir}") + list(APPEND PROTO_DIRS "--proto_path=${dir}") + endif() +endforeach() + # Generate C++ OBJECT library from proto files, # e.g # generate_proto_library( @@ -153,15 +163,6 @@ function(generate_proto_library) if(NOT PROTOC_PRG) message(FATAL_ERROR "protoc binary not found.") endif() - # Get Protobuf include dir - set(PROTO_DIRS) - get_target_property(protobuf_dirs protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) - foreach(dir IN LISTS protobuf_dirs) - if (NOT "${dir}" MATCHES "INSTALL_INTERFACE|-NOTFOUND") - #message(STATUS "Adding proto path: ${dir}") - list(APPEND PROTO_DIRS "--proto_path=${dir}") - endif() - endforeach() # Generate proto C++ files. set(PROTO_HDRS)