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