From 435e276b3fbd29da0b79e254c42e169d66b680a5 Mon Sep 17 00:00:00 2001 From: Deniz Evrenci Date: Mon, 17 Dec 2018 15:44:44 +0900 Subject: [PATCH] [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)