Skip to content

Commit

Permalink
fixup cpp.cmake
Browse files Browse the repository at this point in the history
PROTO_DIRS is used by python/dotnet/java cmake file too
  • Loading branch information
Mizux committed Sep 22, 2023
1 parent a05782c commit dd86fc3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down

0 comments on commit dd86fc3

Please sign in to comment.