Skip to content

Commit

Permalink
PROTON-2774: replace CMAKE_SOURCE_DIR variable with `PROJECT_SOURCE…
Browse files Browse the repository at this point in the history
…_DIR`

This change allows the CMake build file work as an embedded subproject in an composite CMake build
  • Loading branch information
jiridanek committed Oct 14, 2023
1 parent 269ad0a commit caa2db6
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 73 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cmake_minimum_required (VERSION 3.16)

project (Proton C)

set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules")
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/tools/cmake/Modules")
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)

include (CTest)
Expand Down Expand Up @@ -57,10 +57,10 @@ set (ProtonCpp_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/config)

## Variables used across components

set (PN_ENV_SCRIPT "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/scripts/env.py")
set (PN_C_INCLUDE_DIR "${CMAKE_BINARY_DIR}/c/include")
set (PN_C_LIBRARY_DIR "${CMAKE_BINARY_DIR}/c")
set (PN_C_SOURCE_DIR "${CMAKE_BINARY_DIR}/c/src")
set (PN_ENV_SCRIPT "${Python_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/env.py")
set (PN_C_INCLUDE_DIR "${PROJECT_BINARY_DIR}/c/include")
set (PN_C_LIBRARY_DIR "${PROJECT_BINARY_DIR}/c")
set (PN_C_SOURCE_DIR "${PROJECT_BINARY_DIR}/c/src")

## C
set(CMAKE_C_STANDARD 99)
Expand Down Expand Up @@ -118,7 +118,7 @@ if (CMAKE_BUILD_TYPE MATCHES "Coverage")
make_directory(coverage_results)
add_custom_target(coverage
WORKING_DIRECTORY ./coverage_results
COMMAND ${CMAKE_SOURCE_DIR}/scripts/record-coverage.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
COMMAND ${PROJECT_SOURCE_DIR}/scripts/record-coverage.sh ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
endif()

# Try to keep any platform specific overrides together here:
Expand Down Expand Up @@ -338,7 +338,7 @@ if(SWIG_FOUND)
include(UseSWIG)

# All swig modules should include ${PROTON_HEADERS} in SWIG_MODULE_<name>_EXTRA_DEPS
file(GLOB PROTON_HEADERS "${CMAKE_SOURCE_DIR}/c/include/proton/*.h")
file(GLOB PROTON_HEADERS "${PROJECT_SOURCE_DIR}/c/include/proton/*.h")
# All swig modules should include ${BINDING_DEPS} or ${BINDING_DEPS_FULL} in swig_link_libraries
set (BINDING_DEPS qpid-proton-core)
set (BINDING_DEPS_FULL qpid-proton)
Expand Down Expand Up @@ -385,10 +385,10 @@ install (FILES tests/share/examples-README.md RENAME README.md DESTINATION ${PRO
install (DIRECTORY tests DESTINATION ${PROTON_SHARE} PATTERN share EXCLUDE)

# Generate test environment settings
configure_file(${CMAKE_SOURCE_DIR}/misc/config.sh.in
${CMAKE_BINARY_DIR}/config.sh @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/misc/config.bat.in
${CMAKE_BINARY_DIR}/config.bat @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/misc/config.sh.in
${PROJECT_BINARY_DIR}/config.sh @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/misc/config.bat.in
${PROJECT_BINARY_DIR}/config.bat @ONLY)

if (BUILD_EXAMPLES)
add_subdirectory(tests/examples)
Expand Down
4 changes: 2 additions & 2 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ add_custom_command (
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h
COMMAND
${PN_ENV_SCRIPT} PYTHONPATH=${CMAKE_SOURCE_DIR}/tools/python ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h
${PN_ENV_SCRIPT} PYTHONPATH=${PROJECT_SOURCE_DIR}/tools/python ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/encodings.h.py
)
Expand All @@ -76,7 +76,7 @@ add_custom_command (
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h
COMMAND
${PN_ENV_SCRIPT} PYTHONPATH=${CMAKE_SOURCE_DIR}/tools/python ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h
${PN_ENV_SCRIPT} PYTHONPATH=${PROJECT_SOURCE_DIR}/tools/python ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol.h.py > ${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/protocol.h.py
)
Expand Down
32 changes: 16 additions & 16 deletions c/docs/user.doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,26 @@ WARNINGS = YES

# Configuration options related to the input files

INPUT = @CMAKE_SOURCE_DIR@/c/include \
@CMAKE_SOURCE_DIR@/c/examples \
INPUT = @PROJECT_SOURCE_DIR@/c/include \
@PROJECT_SOURCE_DIR@/c/examples \
@CMAKE_CURRENT_SOURCE_DIR@
FILE_PATTERNS = *.h *.md *.dox
EXCLUDE_PATTERNS = @CMAKE_SOURCE_DIR@/c/examples/*.c \
@CMAKE_SOURCE_DIR@/c/examples/*.h \
@CMAKE_SOURCE_DIR@/c/include/proton/cid.h \
@CMAKE_SOURCE_DIR@/c/include/proton/engine.h \
@CMAKE_SOURCE_DIR@/c/include/proton/handlers.h \
@CMAKE_SOURCE_DIR@/c/include/proton/import_export.h \
@CMAKE_SOURCE_DIR@/c/include/proton/log.h \
@CMAKE_SOURCE_DIR@/c/include/proton/object.h \
@CMAKE_SOURCE_DIR@/c/include/proton/reactor.h \
@CMAKE_SOURCE_DIR@/c/include/proton/sasl_plugin.h \
@CMAKE_SOURCE_DIR@/c/include/proton/selectable.h \
@CMAKE_SOURCE_DIR@/c/include/proton/type_compat.h
EXCLUDE_PATTERNS = @PROJECT_SOURCE_DIR@/c/examples/*.c \
@PROJECT_SOURCE_DIR@/c/examples/*.h \
@PROJECT_SOURCE_DIR@/c/include/proton/cid.h \
@PROJECT_SOURCE_DIR@/c/include/proton/engine.h \
@PROJECT_SOURCE_DIR@/c/include/proton/handlers.h \
@PROJECT_SOURCE_DIR@/c/include/proton/import_export.h \
@PROJECT_SOURCE_DIR@/c/include/proton/log.h \
@PROJECT_SOURCE_DIR@/c/include/proton/object.h \
@PROJECT_SOURCE_DIR@/c/include/proton/reactor.h \
@PROJECT_SOURCE_DIR@/c/include/proton/sasl_plugin.h \
@PROJECT_SOURCE_DIR@/c/include/proton/selectable.h \
@PROJECT_SOURCE_DIR@/c/include/proton/type_compat.h
FULL_PATH_NAMES = YES
RECURSIVE = YES
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@/c/include
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/c/examples
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/c/include
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/c/examples
EXAMPLE_RECURSIVE = YES

# View and list options
Expand Down
6 changes: 3 additions & 3 deletions c/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

configure_file(test_config.h.in test_config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/tests/include)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/include)
if (WIN32)
set(test_env "PATH=$<TARGET_FILE_DIR:qpid-proton-core>")
else()
Expand All @@ -31,7 +31,7 @@ endif()
# use the same framework for C++ tests.
# See https://github.com/catchorg/Catch2/blob/v2.x/docs/tutorial.md for more.
#
# ${CMAKE_SOURCE_DIR}/include/tests/catch_extra.cpp has some general extensions to catch.
# ${PROJECT_SOURCE_DIR}/include/tests/catch_extra.cpp has some general extensions to catch.
# ./pn_test.hpp contains proton-C specific code to help with testing.
#
# Tests for each library are combined in a single executable.
Expand Down Expand Up @@ -113,7 +113,7 @@ if (CMAKE_CXX_COMPILER)
set(path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
endif(WIN32)

set(pypath "${CMAKE_SOURCE_DIR}/tests/py")
set(pypath "${PROJECT_SOURCE_DIR}/tests/py")

# Disable fdlimit test by default. Flaky throughout its history and implementations.
# Very useful for proactor development, so keep around.
Expand Down
4 changes: 2 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ set(CXX_EXAMPLE_FLAGS "${CXX_WARNING_FLAGS} ${CXX_STANDARD}")
set(CXX_EXAMPLE_LINK_FLAGS "${SANITIZE_FLAGS}")

include_directories (
"${CMAKE_SOURCE_DIR}/c/include"
"${CMAKE_SOURCE_DIR}/c/src" # Here because of a naughty looking dependency on message-internal.h
"${PROJECT_SOURCE_DIR}/c/include"
"${PROJECT_SOURCE_DIR}/c/src" # Here because of a naughty looking dependency on message-internal.h
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${PN_C_INCLUDE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
Expand Down
18 changes: 9 additions & 9 deletions cpp/docs/user.doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ WARNINGS = YES

# Configuration options related to the input files

INPUT = @CMAKE_SOURCE_DIR@/cpp/docs/pages.dox \
@CMAKE_SOURCE_DIR@/cpp/docs \
@CMAKE_SOURCE_DIR@/cpp/include \
@CMAKE_SOURCE_DIR@/cpp/examples \
@CMAKE_SOURCE_DIR@/docs/connect-config.md
INPUT = @PROJECT_SOURCE_DIR@/cpp/docs/pages.dox \
@PROJECT_SOURCE_DIR@/cpp/docs \
@PROJECT_SOURCE_DIR@/cpp/include \
@PROJECT_SOURCE_DIR@/cpp/examples \
@PROJECT_SOURCE_DIR@/docs/connect-config.md

FILE_PATTERNS = *.hpp *.md *.dox
EXCLUDE_PATTERNS = @CMAKE_SOURCE_DIR@/cpp/examples/*.?pp \
@CMAKE_SOURCE_DIR@/cpp/include/proton/internal/*.hpp
EXCLUDE_PATTERNS = @PROJECT_SOURCE_DIR@/cpp/examples/*.?pp \
@PROJECT_SOURCE_DIR@/cpp/include/proton/internal/*.hpp
FULL_PATH_NAMES = YES
RECURSIVE = YES
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@/cpp/include
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/cpp/examples
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/cpp/include
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/cpp/examples
EXAMPLE_RECURSIVE = YES

# View and list options
Expand Down
2 changes: 1 addition & 1 deletion cpp/testdata/sasl-conf/proton-server.conf.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sasldb_path: ${CMAKE_BINARY_DIR}/cpp/testdata/sasl-conf/proton.sasldb
sasldb_path: ${PROJECT_BINARY_DIR}/cpp/testdata/sasl-conf/proton.sasldb
mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
4 changes: 2 additions & 2 deletions cpp/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endmacro(add_cpp_test)

add_cpp_test(codec_test)
add_cpp_test(connection_driver_test)
add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
add_cpp_test(interop_test ${PROJECT_SOURCE_DIR}/tests)
add_cpp_test(message_test)
add_cpp_test(map_test)
add_cpp_test(scalar_test)
Expand Down Expand Up @@ -81,7 +81,7 @@ endif()
# See c/tests/ for more interesting examples.
# Eventually all the C++ tests will migrate to Catch2.

include_directories(${CMAKE_SOURCE_DIR}/tests/include)
include_directories(${PROJECT_SOURCE_DIR}/tests/include)
add_executable(cpp-test src/cpp-test.cpp src/url_test.cpp)
target_link_libraries(cpp-test qpid-proton-cpp ${PLATFORM_LIBS})
# tests that require access to pn_ functions in qpid-proton-core
Expand Down
6 changes: 3 additions & 3 deletions go/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if (BUILD_GO)
"GOPATH=${GOPATH}"
"CGO_CFLAGS=-I${PN_C_INCLUDE_DIR}"
"CGO_LDFLAGS=-L${PN_C_LIBRARY_DIR}"
"PN_INTEROP_DIR=${CMAKE_SOURCE_DIR}/tests/interop"
"PN_INTEROP_DIR=${PROJECT_SOURCE_DIR}/tests/interop"
"SASLPASSWD=${CyrusSASL_Saslpasswd_EXECUTABLE}"
CACHE INTERNAL "Run a command with Go environment variables")

Expand All @@ -78,12 +78,12 @@ if (BUILD_GO)
add_custom_target(go-build ALL
COMMAND ${GO_INSTALL} ${CMAKE_CURRENT_BINARY_DIR}/pkg/...
DEPENDS qpid-proton-core go-pkg-link go-mod-link
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

add_test(
NAME go-test
COMMAND ${GO_TEST} ${CMAKE_CURRENT_BINARY_DIR}/pkg/...
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

# Clean up go output directories.
list(APPEND ADDITIONAL_MAKE_CLEAN_FILES ${GOPATH}/pkg ${GOPATH}/bin)
Expand Down
4 changes: 2 additions & 2 deletions go/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(BUILD_GO)
# Otherwise it's too hard to get the dependencies right.
add_custom_target(${target} ALL
COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${output} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS go-build)
list(APPEND example_targets ${target})
endforeach()
Expand All @@ -40,7 +40,7 @@ if(BUILD_GO)
set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test)
add_custom_target(go_example_test ALL
COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})

pn_add_test(
UNWRAPPED
Expand Down
4 changes: 2 additions & 2 deletions misc/config.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ SET PROTON_BUILD_CONFIGURATION=relwithdebinfo
REM PROTON_HOME is the root of the proton checkout
REM PROTON_BUILD is where cmake was run

set PROTON_HOME=@CMAKE_SOURCE_DIR@
set PROTON_BUILD=@CMAKE_BINARY_DIR@
set PROTON_HOME=@PROJECT_SOURCE_DIR@
set PROTON_BUILD=@PROJECT_BINARY_DIR@

set PROTON_HOME=%PROTON_HOME:/=\%
set PROTON_BUILD=%PROTON_BUILD:/=\%
Expand Down
4 changes: 2 additions & 2 deletions misc/config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ merge_paths() {
echo $newpath | sed 's/^://' # Remove leading :
}

PROTON_HOME=@CMAKE_SOURCE_DIR@
PROTON_BUILD=@CMAKE_BINARY_DIR@
PROTON_HOME=@PROJECT_SOURCE_DIR@
PROTON_BUILD=@PROJECT_BINARY_DIR@

PYTHON_BINDING=$PROTON_BUILD/python

Expand Down
8 changes: 4 additions & 4 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ install(DIRECTORY examples/
# source distribution for Pypi/pip
#

set(py_csrc_dir ${CMAKE_SOURCE_DIR}/c/src)
set(py_cinc_dir ${CMAKE_SOURCE_DIR}/c/include)
set(py_csrc_dir ${PROJECT_SOURCE_DIR}/c/src)
set(py_cinc_dir ${PROJECT_SOURCE_DIR}/c/include)

file(GLOB_RECURSE py_csrc LIST_DIRECTORIES no
"${py_csrc_dir}/core/*.[ch]"
Expand Down Expand Up @@ -128,9 +128,9 @@ add_custom_command(OUTPUT .timestamp.copied_pysrc
COMMAND ${CMAKE_COMMAND} -E copy ${PN_C_SOURCE_DIR}/core/frame_generators.h src/core
COMMAND ${CMAKE_COMMAND} -E copy ${PN_C_SOURCE_DIR}/core/frame_consumers.c src/core
COMMAND ${CMAKE_COMMAND} -E copy ${PN_C_SOURCE_DIR}/core/frame_consumers.h src/core
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/VERSION.txt .
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/VERSION.txt .
COMMAND ${CMAKE_COMMAND} -E touch .timestamp.copied_pysrc
DEPENDS generated_c_files ${py_cgen} ${py_csrc} ${py_cinc} ${CMAKE_SOURCE_DIR}/VERSION.txt)
DEPENDS generated_c_files ${py_cgen} ${py_csrc} ${py_cinc} ${PROJECT_SOURCE_DIR}/VERSION.txt)

foreach(file IN LISTS py_dist_files pysrc)
add_custom_command(OUTPUT "${file}"
Expand Down
4 changes: 2 additions & 2 deletions ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set(c_lib_dir "$<TARGET_FILE_DIR:qpid-proton>") # Location of qpid-proton librar
## Build the swig library

list(APPEND SWIG_MODULE_cproton-ruby_EXTRA_DEPS
${CMAKE_SOURCE_DIR}/c/include/proton/cproton.i
${PROJECT_SOURCE_DIR}/c/include/proton/cproton.i
${PROTON_HEADERS}
)

Expand Down Expand Up @@ -114,7 +114,7 @@ if (result EQUAL 0) # Have minitest
NAME ${name}
PREPEND_ENVIRONMENT ${test_env}
COMMAND ${RUBY_EXECUTABLE} -r${CMAKE_CURRENT_SOURCE_DIR}/tests/collect_coverage.rb ${script} -v
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} # simplecov doesn't report on code not under $CWD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} # simplecov doesn't report on code not under $CWD
${ARGN})
endmacro()

Expand Down
12 changes: 6 additions & 6 deletions tests/RuntimeCheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mark_as_advanced(TEST_EXE_PREFIX TEST_WRAP_PREFIX TEST_ENV)

# Check for valgrind
find_program(VALGRIND_EXECUTABLE valgrind DOC "location of valgrind program")
set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
set(VALGRIND_SUPPRESSIONS "${PROJECT_SOURCE_DIR}/tests/valgrind.supp" CACHE STRING "Suppressions file for valgrind")
set(VALGRIND_COMMON_ARGS "--error-exitcode=42 --quiet --suppressions=${VALGRIND_SUPPRESSIONS}")
mark_as_advanced(VALGRIND_EXECUTABLE VALGRIND_SUPPRESSIONS VALGRIND_COMMON_ARGS)

Expand Down Expand Up @@ -102,16 +102,16 @@ elseif(RUNTIME_CHECK STREQUAL "asan")
endif()

set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer ${CLANG_ASAN_FLAG} -fsanitize=address,undefined -fsanitize-recover=vptr")
set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
list(APPEND TEST_ENV "UBSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/tests/ubsan.supp")
list(APPEND TEST_ENV "LSAN_OPTIONS=suppressions=${CMAKE_SOURCE_DIR}/tests/lsan.supp")
set(TEST_WRAP_PREFIX "${PROJECT_SOURCE_DIR}/tests/preload_asan.sh $<TARGET_FILE:qpid-proton-core>")
list(APPEND TEST_ENV "UBSAN_OPTIONS=suppressions=${PROJECT_SOURCE_DIR}/tests/ubsan.supp")
list(APPEND TEST_ENV "LSAN_OPTIONS=suppressions=${PROJECT_SOURCE_DIR}/tests/lsan.supp")

elseif(RUNTIME_CHECK STREQUAL "tsan")
assert_has_sanitizers()
message(STATUS "Runtime race checker: gcc/clang thread sanitizer")
set(SANITIZE_FLAGS "-g -fno-omit-frame-pointer -fsanitize=thread")
set(TEST_WRAP_PREFIX "${CMAKE_SOURCE_DIR}/tests/preload_tsan.sh $<TARGET_FILE:qpid-proton-core>")
list(APPEND TEST_ENV "TSAN_OPTIONS=second_deadlock_stack=1 suppressions=${CMAKE_SOURCE_DIR}/tests/tsan.supp")
set(TEST_WRAP_PREFIX "${PROJECT_SOURCE_DIR}/tests/preload_tsan.sh $<TARGET_FILE:qpid-proton-core>")
list(APPEND TEST_ENV "TSAN_OPTIONS=second_deadlock_stack=1 suppressions=${PROJECT_SOURCE_DIR}/tests/tsan.supp")

elseif(RUNTIME_CHECK)
message(FATAL_ERROR "'RUNTIME_CHECK=${RUNTIME_CHECK}' is invalid, valid values: ${runtime_checks}")
Expand Down
2 changes: 1 addition & 1 deletion tests/share/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include(CTest)
include("tests/RuntimeCheck.cmake")

# find example sub-directories that contain "CMakeLists.txt" or "testme"
set(ex_dir "${CMAKE_SOURCE_DIR}/examples")
set(ex_dir "${PROJECT_SOURCE_DIR}/examples")
file(GLOB subs ${ex_dir}/*)
foreach(dir ${subs})
get_filename_component(ex "${dir}" NAME)
Expand Down
6 changes: 3 additions & 3 deletions tools/cmake/config/ProtonConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

set (Proton_VERSION ${PN_VERSION})

set (Proton_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/c/include)
set (Proton_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/c/include)
set (Proton_LIBRARIES ${C_EXAMPLE_LINK_FLAGS} qpid-proton)
set (Proton_DEFINITIONS ${C_EXAMPLE_FLAGS})
set (Proton_FOUND True)

set (Proton_Core_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/c/include)
set (Proton_Core_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/c/include)
set (Proton_Core_LIBRARIES ${C_EXAMPLE_LINK_FLAGS} qpid-proton-core)
set (Proton_Core_DEFINITIONS ${C_EXAMPLE_FLAGS})

Expand All @@ -43,7 +43,7 @@ add_library(Proton::core ALIAS qpid-proton-core)
set (Proton_Core_FOUND True)

if (${HAS_PROACTOR})
set (Proton_Proactor_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/c/include)
set (Proton_Proactor_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/c/include)
set (Proton_Proactor_LIBRARIES ${C_EXAMPLE_LINK_FLAGS} qpid-proton-proactor)
set (Proton_Proactor_DEFINITIONS ${C_EXAMPLE_FLAGS})

Expand Down
4 changes: 2 additions & 2 deletions tools/cmake/config/ProtonCppConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
# tree build and installed in the appropriate place for cmake on that system.

set (ProtonCpp_VERSION ${PN_VERSION})
set (ProtonCpp_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/c/include ${CMAKE_SOURCE_DIR}/cpp/include
${CMAKE_BINARY_DIR}/cpp)
set (ProtonCpp_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/c/include ${PROJECT_SOURCE_DIR}/cpp/include
${PROJECT_BINARY_DIR}/cpp)
set (ProtonCpp_LIBRARIES ${CXX_EXAMPLE_LINK_FLAGS} qpid-proton-cpp)
set (ProtonCpp_DEFINITIONS ${CXX_EXAMPLE_FLAGS})

Expand Down

0 comments on commit caa2db6

Please sign in to comment.