Skip to content

Commit dbee6df

Browse files
authored
Merge pull request #3582 from billsacks/cmake_use_function
Use a CMake function provided by CIME Ran unit tester again and it all works.
2 parents c9a41e0 + b18bf0e commit dbee6df

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

src/CMakeLists.txt

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,16 @@ add_subdirectory(${CLM_ROOT}/src/self_tests clm_self_tests)
7878
add_subdirectory(unit_test_stubs)
7979
add_subdirectory(unit_test_shr)
8080

81-
# Remove some things from share_sources
82-
#
83-
# TODO: this should be moved into a general-purpose function in Sourcelist_utils.
84-
# Then each removal could be replaced with a single call, like:
85-
# remove_source_file(${share_sources} "shr_mpi_mod.F90")
86-
foreach(sourcefile ${share_sources})
87-
# Remove shr_mpi_mod from share_sources.
88-
# This is needed because we want to use the mock shr_mpi_mod in place of the real one
89-
string(REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile})
90-
91-
if(match_found)
92-
list(REMOVE_ITEM share_sources ${sourcefile})
93-
endif()
94-
95-
# Remove shr_pio_mod from share_sources. This is needed to avoid an explicit dependency
96-
# on PIO. This removal is needed on some systems but not on others: the unit test build
97-
# works without this removal on a Mac with a pre-built PIO library, but failed (with
98-
# error message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO
99-
# (where ESMF was built with its internal PIO).
100-
string(REGEX MATCH "shr_pio_mod.F90" match_found ${sourcefile})
101-
102-
if(match_found)
103-
list(REMOVE_ITEM share_sources ${sourcefile})
104-
endif()
105-
endforeach()
81+
# Remove shr_mpi_mod from share_sources. This is needed because we want to use the mock
82+
# shr_mpi_mod in place of the real one.
83+
remove_source_file("shr_mpi_mod.F90" share_sources)
84+
85+
# Remove shr_pio_mod from share_sources. This is needed to avoid an explicit dependency on
86+
# PIO. This removal is needed on some systems but not on others: the unit test build works
87+
# without this removal on a Mac with a pre-built PIO library, but failed (with error
88+
# message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO (where
89+
# ESMF was built with its internal PIO).
90+
remove_source_file("shr_pio_mod.F90" share_sources)
10691

10792
# Build libraries containing stuff needed for the unit tests.
10893
# 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)