From 1b1508521a1365ce8cec96ba32a183eea9ba36cd Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Wed, 18 Dec 2024 15:44:59 -0700 Subject: [PATCH] Use object libraries for test fixtures and example helpers --- example/CMakeLists.txt | 4 +++- test/CMakeLists.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index c9fabb6..2ae0bc6 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -2,9 +2,11 @@ include(CTest) include_directories(${CMAKE_Fortran_MODULE_DIRECTORY}) +add_library(helpers OBJECT testing_helpers.f90) + function(make_example example_name) add_test(NAME ${example_name} COMMAND ${example_name} ${CMAKE_CURRENT_SOURCE_DIR}) - add_executable(${example_name} ${example_name}.f90 testing_helpers.f90) + add_executable(${example_name} ${example_name}.f90 $) target_link_libraries(${example_name} ${bmi_name}) endfunction(make_example) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 463b8e4..53daa32 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,9 +2,11 @@ include(CTest) include_directories(${CMAKE_Fortran_MODULE_DIRECTORY}) +add_library(fixtures OBJECT fixtures.f90) + function(make_test test_name) add_test(NAME ${test_name} COMMAND ${test_name} "${CMAKE_CURRENT_SOURCE_DIR}/sample.cfg") - add_executable(${test_name} ${test_name}.f90 fixtures.f90) + add_executable(${test_name} ${test_name}.f90 $) target_link_libraries(${test_name} ${bmi_name}) endfunction(make_test)