diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f5df3c026..4ca48530d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,7 +64,7 @@ jobs: dependencies: "sudo apt install ninja-build" build-type: Release self-host: true - extra-cmake-flags: "-DSNMALLOC_BENCHMARK_INDIVIDUAL_MITIGATIONS=On -DBUILD_TESTING=Off" + extra-cmake-flags: "-DSNMALLOC_BENCHMARK_INDIVIDUAL_MITIGATIONS=On -DSNMALLOC_BUILD_TESTING=Off" # Check that we can build specifically with libstdc++ - os: "ubuntu-latest" variant: "libstdc++ (Build only)" diff --git a/CMakeLists.txt b/CMakeLists.txt index f2d1233b1..1d9cbb6d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ include(CheckIPOSupported) include(CMakeDependentOption) # Name chosen for compatibility with CTest. -option(BUILD_TESTING "Build test programs as well as shims" ON) +option(SNMALLOC_BUILD_TESTING "Build test programs as well as shims" ON) option(SNMALLOC_HEADER_ONLY_LIBRARY "Use snmalloc has a header-only library" OFF) # Options that apply globally @@ -288,7 +288,7 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) set(TESTDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/test) - if(BUILD_TESTING) + if(SNMALLOC_BUILD_TESTING) enable_testing() subdirlist(TEST_CATEGORIES ${TESTDIR}) else() @@ -448,7 +448,7 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) target_compile_definitions(snmallocshim-checks-rust PRIVATE SNMALLOC_CHECK_CLIENT) endif() - if (BUILD_TESTING) + if (SNMALLOC_BUILD_TESTING) if (WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL NetBSD) OR (CMAKE_SYSTEM_NAME STREQUAL OpenBSD) @@ -496,7 +496,7 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) set(DEFINES "SNMALLOC_CHECK_CLIENT_MITIGATIONS=${MITIGATION}") add_shim(snmallocshim-${MITIGATION} SHARED ${SHIM_FILES}) target_compile_definitions(snmallocshim-${MITIGATION} PRIVATE ${DEFINES}) - if (BUILD_TESTING) + if (SNMALLOC_BUILD_TESTING) make_tests(${MITIGATION} ${DEFINES}) endif() endforeach() @@ -511,13 +511,15 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) set(DEFINES "-DSNMALLOC_CHECK_CLIENT_MITIGATIONS=${MITIGATIONSET}") add_shim(snmallocshim-${MITIGATIONNAME} SHARED ${SHIM_FILES}) target_compile_definitions(snmallocshim-${MITIGATIONNAME} PRIVATE ${DEFINES}) - if (BUILD_TESTING) + if (SNMALLOC_BUILD_TESTING) make_tests(${MITIGATIONNAME} ${DEFINES}) endif() endforeach() endif() - clangformat_targets() + if (SNMALLOC_BUILD_TESTING) + clangformat_targets() + endif () endif() install(TARGETS snmalloc EXPORT snmallocConfig)