From eabd7d66e3a7b43348fc916b5314005d4d17f617 Mon Sep 17 00:00:00 2001 From: Deniz Evrenci Date: Mon, 17 Dec 2018 16:27:59 +0900 Subject: [PATCH 1/2] [C++] Make driver tests inherit include directories from aeron_client. This will further allow us to inherit other libraries and compile definitions that the aeron_client's public interface requires. --- aeron-driver/src/test/c/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aeron-driver/src/test/c/CMakeLists.txt b/aeron-driver/src/test/c/CMakeLists.txt index 2a41c64a37..bc99cacf37 100644 --- a/aeron-driver/src/test/c/CMakeLists.txt +++ b/aeron-driver/src/test/c/CMakeLists.txt @@ -14,13 +14,12 @@ # limitations under the License. include_directories(${AERON_DRIVER_SOURCE_PATH}) -include_directories(${AERON_CLIENT_SOURCE_PATH}) set(TEST_HEADERS aeron_driver_conductor_test.h) function(aeron_driver_test name file) add_executable(${name} ${file} ${TEST_HEADERS}) - target_link_libraries(${name} aeron_driver ${GMOCK_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${name} aeron_client aeron_driver ${GMOCK_LIBS} ${CMAKE_THREAD_LIBS_INIT}) add_dependencies(${name} gmock) add_test(NAME ${name} COMMAND ${name}) endfunction() From 435e276b3fbd29da0b79e254c42e169d66b680a5 Mon Sep 17 00:00:00 2001 From: Deniz Evrenci Date: Mon, 17 Dec 2018 15:44:44 +0900 Subject: [PATCH 2/2] [C++] Add definition for __PROJECT_SOURCE_DIR__ to aeron_client's public interface. This is required in case there is an upper level directory that includes Aeron. In that case the added definitions do not reach the source files that may include Aeron headers and __PROJECT_SOURCE_DIR__ will be undefined to them. --- CMakeLists.txt | 3 --- aeron-client/src/main/cpp/CMakeLists.txt | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab7713135a..f63f64dc94 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,9 +58,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE) endif(NOT CMAKE_BUILD_TYPE) -# relative file paths for use in exceptions -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__PROJECT_SOURCE_DIR__='\"${PROJECT_SOURCE_DIR}\"'") - set(AERON_THIRDPARTY_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty") ########################################################## diff --git a/aeron-client/src/main/cpp/CMakeLists.txt b/aeron-client/src/main/cpp/CMakeLists.txt index 2b379dc39d..6c3e06469a 100644 --- a/aeron-client/src/main/cpp/CMakeLists.txt +++ b/aeron-client/src/main/cpp/CMakeLists.txt @@ -127,6 +127,11 @@ target_include_directories(aeron_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) +# relative file paths for use in exceptions +target_compile_definitions(aeron_client + PUBLIC "__PROJECT_SOURCE_DIR__=\"${PROJECT_SOURCE_DIR}\"" +) + if (NOT WIN32) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE)