cmake: Set PROTOBUF_IMPORT_DIRS in toplevel dir
The variable PROTOBUF_IMPORT_DIRS has to be set in the toplevel CMakeLists.txt, since the import path has to be available for all .proto files within all subdirectories. Without this addition, the GenericExperiment will fail to compile. Change-Id: I676e0abd83bd1c5d247afcd33e7522e72da3dc2f
This commit is contained in:
@ -7,7 +7,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/core)
|
||||
# protoc imports refer to the same root path. Otherwise the generated
|
||||
# protoc headers are not comptabile.
|
||||
SET(PROTOBUF_GENERATE_CPP_APPEND_PATH FALSE)
|
||||
SET(PROTOBUF_IMPORT_DIRS "/usr/include;${CMAKE_CURRENT_SOURCE_DIR}/core/comm")
|
||||
SET(PROTOBUF_IMPORT_DIRS "/usr/include;${CMAKE_CURRENT_SOURCE_DIR}/core/comm"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/core/comm")
|
||||
|
||||
|
||||
# Note: CMAKE_CURRENT_BINARY_DIR is needed to find "FailConfig.hpp", which
|
||||
# is generated by CMake from config/FailConfig.hpp.in and stored in
|
||||
|
||||
@ -30,8 +30,7 @@ find_package(Protobuf REQUIRED)
|
||||
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# Let protobuf compiler find defined file (DatabaseCampaignMessage) in binary tree
|
||||
set(PROTOBUF_IMPORT_DIRS ${PROTOBUF_IMPORT_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
# The PROTOBUF_IMPORT_DIRS is set in src/CMakeLists.txt
|
||||
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTOS})
|
||||
|
||||
add_custom_target(fail-protoc
|
||||
|
||||
Reference in New Issue
Block a user