Skip to content

Commit 9b21390

Browse files
committed
Use a CMake function provided by CIME
Requires cime6.1.137
1 parent 7ab0439 commit 9b21390

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

src/CMakeLists.txt

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,16 @@ add_subdirectory(${CLM_ROOT}/src/self_tests clm_self_tests)
6363
add_subdirectory(unit_test_stubs)
6464
add_subdirectory(unit_test_shr)
6565

66-
# Remove some things from share_sources
67-
#
68-
# TODO: this should be moved into a general-purpose function in Sourcelist_utils.
69-
# Then each removal could be replaced with a single call, like:
70-
# remove_source_file(${share_sources} "shr_mpi_mod.F90")
71-
foreach (sourcefile ${share_sources})
72-
# Remove shr_mpi_mod from share_sources.
73-
# This is needed because we want to use the mock shr_mpi_mod in place of the real one
74-
string(REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile})
75-
if(match_found)
76-
list(REMOVE_ITEM share_sources ${sourcefile})
77-
endif()
78-
79-
# Remove shr_pio_mod from share_sources. This is needed to avoid an explicit dependency
80-
# on PIO. This removal is needed on some systems but not on others: the unit test build
81-
# works without this removal on a Mac with a pre-built PIO library, but failed (with
82-
# error message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO
83-
# (where ESMF was built with its internal PIO).
84-
string(REGEX MATCH "shr_pio_mod.F90" match_found ${sourcefile})
85-
if(match_found)
86-
list(REMOVE_ITEM share_sources ${sourcefile})
87-
endif()
88-
endforeach()
66+
# Remove shr_mpi_mod from share_sources. This is needed because we want to use the mock
67+
# shr_mpi_mod in place of the real one.
68+
remove_source_file("shr_mpi_mod.F90" share_sources)
69+
70+
# Remove shr_pio_mod from share_sources. This is needed to avoid an explicit dependency on
71+
# PIO. This removal is needed on some systems but not on others: the unit test build works
72+
# without this removal on a Mac with a pre-built PIO library, but failed (with error
73+
# message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO (where
74+
# ESMF was built with its internal PIO).
75+
remove_source_file("shr_pio_mod.F90" share_sources)
8976

9077
# Build libraries containing stuff needed for the unit tests.
9178
# Eventually, these add_library calls should probably be distributed into the correct location, rather than being in this top-level CMakeLists.txt file.

0 commit comments

Comments
 (0)