From 0ba03ca97ec76cd63abe7b2deaf87eda06a518d1 Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Wed, 22 Oct 2014 16:14:26 +0200 Subject: [PATCH] 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 --- src/CMakeLists.txt | 4 +++- src/core/comm/CMakeLists.txt | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d84ce83..7c7b171f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/core/comm/CMakeLists.txt b/src/core/comm/CMakeLists.txt index b7aece05..592bc718 100644 --- a/src/core/comm/CMakeLists.txt +++ b/src/core/comm/CMakeLists.txt @@ -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