From f6055eb0fd3e197d953945e26790824f22cffc04 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Fri, 2 Feb 2024 10:46:18 -0700 Subject: [PATCH] cprnc should not be injecting its ctests into host projects --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c3642b..be7e1e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,9 @@ cmake_minimum_required (VERSION 3.14) + +if (NOT DEFINED PROJECT_NAME) + set(CPRNC_STANDALONE TRUE) +endif() + project (cprnc Fortran C) include (CheckFunctionExists) include (ExternalProject) @@ -95,9 +100,11 @@ set_property(TARGET cprnc PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries (cprnc PUBLIC ${NetCDF_Fortran_LIBRARIES} ${NetCDF_C_LIBRARIES} ${NetCDF_LIBRARIES}) - -enable_testing() -add_test(NAME run_tests COMMAND run_tests -outdir tmp) +# We do not want cprnc injecting ctests into parent projects +if (CPRNC_STANDALONE) + enable_testing() + add_test(NAME run_tests COMMAND run_tests -outdir tmp) +endif() #============================================================================== # DEFINE THE INSTALL