diff --git a/CMakeLists.txt b/CMakeLists.txt index cc9f95f33..0948c3b59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if(VISOR_PRERELEASE STREQUAL "-develop" OR VISOR_PRERELEASE STREQUAL "-rc") execute_process( COMMAND git rev-parse --short HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE SHORT_HASH_RESULT OUTPUT_VARIABLE @@ -41,13 +41,13 @@ set(VISOR_VERSION "pktvisor ${PROJECT_VERSION}${VISOR_PRERELEASE}") # used in CI file(WRITE ${CMAKE_BINARY_DIR}/VERSION ${VISOR_VERSION_NUM}) # golang version -configure_file(golang/pkg/client/version.go.in ${CMAKE_SOURCE_DIR}/golang/pkg/client/version.go) +configure_file(golang/pkg/client/version.go.in ${PROJECT_SOURCE_DIR}/golang/pkg/client/version.go) ####### end version code ####### if(NOT DEFINED ENV{VERSION_ONLY}) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -77,7 +77,7 @@ if(PKTVISOR_CONAN_INIT) endif() conan_cmake_install( - PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR} + PATH_OR_REFERENCE ${PROJECT_SOURCE_DIR} BUILD ${PKTVISOR_CONAN_BUILD} PROFILE_BUILD ${PKTVISOR_CONAN_BUILD_PROFILE} PROFILE_HOST ${PKTVISOR_CONAN_HOST_PROFILE} diff --git a/cmd/pktvisor-pcap/CMakeLists.txt b/cmd/pktvisor-pcap/CMakeLists.txt index dd56e04f8..724a8d2fe 100644 --- a/cmd/pktvisor-pcap/CMakeLists.txt +++ b/cmd/pktvisor-pcap/CMakeLists.txt @@ -1,10 +1,5 @@ add_executable(pktvisor-pcap main.cpp) -target_include_directories(pktvisor-pcap - PRIVATE - ${CMAKE_BINARY_DIR}/src # Visor::Core config.h - ) - target_link_libraries(pktvisor-pcap PRIVATE ${CONAN_LIBS_DOCOPT.CPP} diff --git a/cmd/pktvisor-reader/CMakeLists.txt b/cmd/pktvisor-reader/CMakeLists.txt index 3dc11d649..6f95f7451 100644 --- a/cmd/pktvisor-reader/CMakeLists.txt +++ b/cmd/pktvisor-reader/CMakeLists.txt @@ -1,10 +1,5 @@ add_executable(pktvisor-reader main.cpp) -target_include_directories(pktvisor-reader - PRIVATE - ${CMAKE_BINARY_DIR}/src # Visor::Core config.h - ) - target_link_libraries(pktvisor-reader PRIVATE ${CONAN_LIBS_DOCOPT.CPP} diff --git a/cmd/pktvisord/CMakeLists.txt b/cmd/pktvisord/CMakeLists.txt index d0e737e4a..0df6b485e 100644 --- a/cmd/pktvisord/CMakeLists.txt +++ b/cmd/pktvisord/CMakeLists.txt @@ -1,10 +1,5 @@ add_executable(pktvisord main.cpp) -target_include_directories(pktvisord - PRIVATE - ${CMAKE_BINARY_DIR}/src # Visor::Core config.h - ) - target_link_libraries(pktvisord PRIVATE timer diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ae649917c..21616ebf4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,8 +19,8 @@ add_library(visor-core add_library(Visor::Core ALIAS visor-core) target_include_directories(visor-core - PRIVATE - ${CMAKE_BINARY_DIR}/src # Visor::Core config.h + PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} # Visor::Core config.h INTERFACE $ ) @@ -63,6 +63,6 @@ target_include_directories(unit-tests-vizor-core target_link_libraries(unit-tests-vizor-core PRIVATE Visor::Core ${VISOR_STATIC_PLUGINS}) add_test(NAME unit-tests-vizor-core - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-vizor-core ) \ No newline at end of file diff --git a/src/handlers/dhcp/tests/CMakeLists.txt b/src/handlers/dhcp/tests/CMakeLists.txt index a07f74a43..5e5890380 100644 --- a/src/handlers/dhcp/tests/CMakeLists.txt +++ b/src/handlers/dhcp/tests/CMakeLists.txt @@ -12,6 +12,6 @@ target_link_libraries(unit-tests-handler-dhcp Visor::Handler::Dhcp) add_test(NAME unit-tests-handler-dhcp - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-handler-dhcp ) diff --git a/src/handlers/dns/tests/CMakeLists.txt b/src/handlers/dns/tests/CMakeLists.txt index 06bcbab45..fa99dcfaf 100644 --- a/src/handlers/dns/tests/CMakeLists.txt +++ b/src/handlers/dns/tests/CMakeLists.txt @@ -14,7 +14,7 @@ target_link_libraries(unit-tests-handler-dns Visor::Handler::Dns) add_test(NAME unit-tests-handler-dns - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-handler-dns ) diff --git a/src/handlers/net/tests/CMakeLists.txt b/src/handlers/net/tests/CMakeLists.txt index c422cbaf7..fe67ec91e 100644 --- a/src/handlers/net/tests/CMakeLists.txt +++ b/src/handlers/net/tests/CMakeLists.txt @@ -12,6 +12,6 @@ target_link_libraries(unit-tests-handler-net Visor::Handler::Net) add_test(NAME unit-tests-handler-net - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-handler-net ) diff --git a/src/handlers/pcap/tests/CMakeLists.txt b/src/handlers/pcap/tests/CMakeLists.txt index b208b197c..943453032 100644 --- a/src/handlers/pcap/tests/CMakeLists.txt +++ b/src/handlers/pcap/tests/CMakeLists.txt @@ -12,6 +12,6 @@ target_link_libraries(unit-tests-handler-pcap Visor::Handler::Pcap) add_test(NAME unit-tests-handler-pcap - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-handler-pcap ) diff --git a/src/inputs/dnstap/CMakeLists.txt b/src/inputs/dnstap/CMakeLists.txt index 6f39aabb0..6f3c27d2d 100644 --- a/src/inputs/dnstap/CMakeLists.txt +++ b/src/inputs/dnstap/CMakeLists.txt @@ -43,6 +43,6 @@ target_link_libraries(unit-tests-input-dnstap ) add_test(NAME unit-tests-input-dnstap - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-input-dnstap ) diff --git a/src/inputs/mock/CMakeLists.txt b/src/inputs/mock/CMakeLists.txt index 85110cc28..7f9b279d5 100644 --- a/src/inputs/mock/CMakeLists.txt +++ b/src/inputs/mock/CMakeLists.txt @@ -32,6 +32,6 @@ target_link_libraries(unit-tests-input-mock ) add_test(NAME unit-tests-input-mock - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-input-mock ) diff --git a/src/inputs/pcap/CMakeLists.txt b/src/inputs/pcap/CMakeLists.txt index a259d07f1..1c92dd380 100644 --- a/src/inputs/pcap/CMakeLists.txt +++ b/src/inputs/pcap/CMakeLists.txt @@ -38,6 +38,6 @@ target_link_libraries(unit-tests-input-pcap ) add_test(NAME unit-tests-input-pcap - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-input-pcap ) diff --git a/src/inputs/sflow/CMakeLists.txt b/src/inputs/sflow/CMakeLists.txt index 2ad7546c8..641925524 100644 --- a/src/inputs/sflow/CMakeLists.txt +++ b/src/inputs/sflow/CMakeLists.txt @@ -37,6 +37,6 @@ target_link_libraries(unit-tests-input-sflow ) add_test(NAME unit-tests-input-sflow - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src COMMAND unit-tests-input-sflow ) \ No newline at end of file