From 90f49949fc55c0ef81936753fe41915fefe8b032 Mon Sep 17 00:00:00 2001 From: program-- Date: Thu, 7 Sep 2023 09:51:07 -0700 Subject: [PATCH] cmake: change defaults again; attempt to fix CI issues --- CMakeLists.txt | 11 ++++++----- src/core/mediator/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 4 +++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ecb0a1a99c..6260c6b905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,13 +36,13 @@ include(GitUpdateSubmodules) # Options ===================================================================== include(CMakeDependentOption) -option(NGEN_WITH_MPI "Build with MPI support" ON) +option(NGEN_WITH_MPI "Build with MPI support" OFF) option(NGEN_WITH_NETCDF "Build with NetCDF support" ON) option(NGEN_WITH_SQLITE "Build with SQLite3 support" ON) option(NGEN_WITH_UDUNITS "Build with UDUNITS2 support" ON) -option(NGEN_WITH_BMI_FORTRAN "Build with Fortran BMI support" ON) -option(NGEN_WITH_BMI_C "Build with C BMI support" ON) -option(NGEN_WITH_PYTHON "Build with embedded Python support" ON) +option(NGEN_WITH_BMI_FORTRAN "Build with Fortran BMI support" OFF) +option(NGEN_WITH_BMI_C "Build with C BMI support" OFF) +option(NGEN_WITH_PYTHON "Build with embedded Python support" OFF) option(NGEN_WITH_TESTS "Build with unit tests" ON) option(NGEN_QUIET "Silence output" OFF) @@ -69,6 +69,8 @@ deprecated_option(OLD PACKAGE_TESTS NEW NGEN_WITH_TESTS) # Define project version and use via generated config header project(ngen VERSION 0.1.0) +configure_file("${NGEN_INC_DIR}/NGenConfig.h.in" "${NGEN_INC_DIR}/NGenConfig.h") + add_executable(ngen "${NGEN_SRC_DIR}/NGen.cpp") # Dependencies ================================================================ @@ -232,7 +234,6 @@ add_subdirectory(${TEST_BMI_CPP_DIR} ${TEST_BMI_CPP_DIR}/cmake_build) # FIXME: W # ----------------------------------------------------------------------------- # Project Targets # ----------------------------------------------------------------------------- -configure_file(include/NGenConfig.h.in include/NGenConfig.h) add_dependencies(ngen testbmicppmodel) target_include_directories(ngen PUBLIC "${NGEN_INC_DIR}") diff --git a/src/core/mediator/CMakeLists.txt b/src/core/mediator/CMakeLists.txt index b1c336cd67..6384473db5 100644 --- a/src/core/mediator/CMakeLists.txt +++ b/src/core/mediator/CMakeLists.txt @@ -2,9 +2,9 @@ include(${PROJECT_SOURCE_DIR}/cmake/dynamic_sourced_library.cmake) dynamic_sourced_cxx_library(core_mediator "${CMAKE_CURRENT_SOURCE_DIR}") add_library(NGen::core_mediator ALIAS core_mediator) + if(NGEN_WITH_UDUNITS) - add_dependencies(core_mediator libudunits2) - target_link_libraries(core_mediator PUBLIC libudunits2) + target_link_libraries(core_mediator PUBLIC libudunits2) endif() find_package(Threads REQUIRED) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d6fd26351d..44046d32ae 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,7 +59,7 @@ function(ngen_add_test TESTNAME) if(NGEN_TEST_CREATE) add_executable(${TESTNAME} ${NGEN_TEST_OBJECTS}) - target_link_libraries(${TESTNAME} gtest gtest_main ${NGEN_TEST_LIBRARIES}) + target_link_libraries(${TESTNAME} PUBLIC gtest gtest_main ${NGEN_TEST_LIBRARIES}) set_target_properties(${TESTNAME} PROPERTIES FOLDER test) gtest_discover_tests( ${TESTNAME} @@ -177,6 +177,7 @@ ngen_add_test( realizations/catchments/Bmi_C_Adapter_Test.cpp realizations/catchments/Bmi_C_Formulation_Test.cpp LIBRARIES + gmock NGen::core NGen::realizations_catchment NGen::core_mediator @@ -326,6 +327,7 @@ ngen_add_test( utils/mdframe_netcdf_Test.cpp utils/mdframe_csv_Test.cpp LIBRARIES + gmock NGen::core NGen::core_nexus NGen::core_mediator