From 2d86ae4fc11288f1da84422d7f8eb97799ba4f89 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sat, 19 Oct 2024 21:06:50 +0200 Subject: [PATCH] build: all FetchContent packages should be SYSTEM --- CMakeLists.txt | 6 +++--- cmake/need_fmt.cmake | 3 ++- cmake/need_gtest.cmake | 1 + cmake/need_phmap.cmake | 1 + cmake/need_range_v3.cmake | 1 + ricepp/CMakeLists.txt | 4 ++-- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82ac9be3..0099a025 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -503,7 +503,7 @@ if(WITH_TESTS) ### include paths are searched first. get_target_property(gmock_include_dirs gmock INTERFACE_INCLUDE_DIRECTORIES) get_target_property(gtest_include_dirs gtest INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${test} PRIVATE BEFORE ${gmock_include_dirs} ${gtest_include_dirs}) + target_include_directories(${test} SYSTEM PRIVATE BEFORE ${gmock_include_dirs} ${gtest_include_dirs}) endif() target_compile_definitions(${test} @@ -597,7 +597,7 @@ if(WITH_LIBDWARFS AND WITH_FUZZ) endif() foreach(tgt ${LIBDWARFS_TARGETS}) - target_include_directories(${tgt} PRIVATE + target_include_directories(${tgt} SYSTEM PRIVATE $> ) endforeach() @@ -626,7 +626,7 @@ foreach(tgt ${LIBDWARFS_TARGETS} ${LIBDWARFS_OBJECT_TARGETS} dwarfs_test_helpers $ ) - target_include_directories(${tgt} PUBLIC + target_include_directories(${tgt} SYSTEM PUBLIC $> ) diff --git a/cmake/need_fmt.cmake b/cmake/need_fmt.cmake index 0742780a..5c65da74 100644 --- a/cmake/need_fmt.cmake +++ b/cmake/need_fmt.cmake @@ -26,6 +26,7 @@ if(NOT fmt_FOUND) GIT_REPOSITORY ${LIBFMT_GIT_REPO} GIT_TAG ${LIBFMT_PREFERRED_VERSION} EXCLUDE_FROM_ALL + SYSTEM ) FetchContent_MakeAvailable(fmt) endif() @@ -35,5 +36,5 @@ if(fmt_FOUND OR STATIC_BUILD_DO_NOT_USE OR WIN32) set(DWARFS_FMT_LIB fmt::fmt) else() add_compile_definitions(FMT_HEADER_ONLY) - include_directories($>) + include_directories(SYSTEM $>) endif() diff --git a/cmake/need_gtest.cmake b/cmake/need_gtest.cmake index 76945824..ffa22256 100644 --- a/cmake/need_gtest.cmake +++ b/cmake/need_gtest.cmake @@ -41,6 +41,7 @@ else() GIT_REPOSITORY ${GOOGLETEST_GIT_REPO} GIT_TAG v${GOOGLETEST_PREFERRED_VERSION} EXCLUDE_FROM_ALL + SYSTEM ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) diff --git a/cmake/need_phmap.cmake b/cmake/need_phmap.cmake index ddd94a6d..85259e70 100644 --- a/cmake/need_phmap.cmake +++ b/cmake/need_phmap.cmake @@ -46,6 +46,7 @@ else() GIT_REPOSITORY ${PARALLEL_HASHMAP_GIT_REPO} GIT_TAG v${PARALLEL_HASHMAP_PREFERRED_VERSION} EXCLUDE_FROM_ALL + SYSTEM ) FetchContent_MakeAvailable(parallel-hashmap) endif() diff --git a/cmake/need_range_v3.cmake b/cmake/need_range_v3.cmake index 717a2f4f..3cb9b11f 100644 --- a/cmake/need_range_v3.cmake +++ b/cmake/need_range_v3.cmake @@ -26,6 +26,7 @@ if(NOT range-v3_FOUND) GIT_REPOSITORY ${RANGE_V3_GIT_REPO} GIT_TAG ${RANGE_V3_PREFERRED_VERSION} EXCLUDE_FROM_ALL + SYSTEM ) FetchContent_MakeAvailable(range-v3) endif() diff --git a/ricepp/CMakeLists.txt b/ricepp/CMakeLists.txt index 133cbc32..8b80dfe6 100644 --- a/ricepp/CMakeLists.txt +++ b/ricepp/CMakeLists.txt @@ -70,7 +70,7 @@ foreach(target ${RICEPP_LIBS_CPUSPECIFIC}) message(STATUS "[ricepp] adding CPU target: ${target}") target_include_directories(${target} PUBLIC $) # target_link_libraries(${target} PUBLIC range-v3::range-v3) - target_include_directories(${target} PUBLIC + target_include_directories(${target} SYSTEM PUBLIC $> ) target_compile_features(${target} PUBLIC cxx_std_20) @@ -80,7 +80,7 @@ endforeach() add_library(ricepp-core OBJECT ricepp.cpp) # target_link_libraries(ricepp-core PUBLIC range-v3::range-v3) -target_include_directories(ricepp-core PUBLIC +target_include_directories(ricepp-core SYSTEM PUBLIC $> ) target_include_directories(ricepp-core PUBLIC