From aba2d14762fbc4596f9b32d5acb7a87920092d40 Mon Sep 17 00:00:00 2001 From: Matt Shin Date: Mon, 22 Sep 2025 15:30:42 +0100 Subject: [PATCH] cmake configure test only when BUILD_TESTING=ON Determine whether to build tests by following the CTest module BUILD_TESTING option. --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6dfae8..4a73ed2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,11 +45,13 @@ get_directory_property(MONIO_DEFINITIONS COMPILE_DEFINITIONS) ## Sources include(monio_compiler_flags) -include_directories(${MONIO_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/test) - +include_directories(${MONIO_INCLUDE_DIRS}) add_subdirectory(src) -add_subdirectory(test) + +if(BUILD_TESTING) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test) + add_subdirectory(test) +endif() ## Finalise configuration ecbuild_install_project(NAME ${PROJECT_NAME})