From 86caa019e7a9b5bf30fdbc39274e260218a7247e Mon Sep 17 00:00:00 2001 From: Eric-Butcher Date: Sun, 6 Jul 2025 18:36:43 -0400 Subject: [PATCH] Fixed CMakeLists so that tests always compile but are no included in the packages. --- CMakeLists.txt | 5 +---- tests/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f586ce8..1b218fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,9 +54,6 @@ endif() enable_testing() -# Do not want to include Google Test in the installation packages -if(BUILD_TESTING) - add_subdirectory(tests) -endif() +add_subdirectory(tests) add_subdirectory(packaging) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a9db20c..e5deeca 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,6 +9,11 @@ FetchContent_Declare( ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + +# Prevent GoogleTest from being installed by CPack +set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) +set(INSTALL_GMOCK OFF CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(googletest) # Collect test sources