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:
Christian Dietrich
2014-10-22 16:14:26 +02:00
parent 0317be8f8f
commit 0ba03ca97e
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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