@@ -13,18 +13,20 @@ project(clm_tests Fortran C)
1313
1414include (CIME_utils)
1515
16-
1716# find needed external packages
1817# NetCDF is required -- because PIO and NetCDF are required by the standard default ESMF libraries
1918find_package (NetCDF 4.7.4 REQUIRED Fortran)
2019
2120# The following - for finding ESMF - is copied from the share CMakeLists.txt
22- if (DEFINED ENV{ESMF_ROOT})
21+ if (DEFINED ENV{ESMF_ROOT})
2322 list (APPEND CMAKE_MODULE_PATH $ENV{ESMF_ROOT} /cmake)
2423endif ()
24+
2525find_package (ESMF REQUIRED)
26+
2627# This adds include directories needed for ESMF
2728set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ESMF_F90COMPILEPATHS} " )
29+
2830# This (which is *not* done in the share CMakeLists.txt) adds all directories and
2931# libraries needed when linking ESMF, including any dependencies of ESMF. (But note that
3032# this does *not* include the "-lesmf" itself). In particular, note that this includes any
@@ -43,12 +45,12 @@ add_subdirectory(${SRCROOT}/share/src csm_share)
4345add_subdirectory (${SRCROOT} /share/unit_test_stubs/util csm_share_stubs)
4446
4547# Add files needed from CMEPS
46- list ( APPEND drv_sources_needed
48+ list ( APPEND drv_sources_needed
4749 ${SRCROOT} /components/cmeps/cesm/nuopc_cap_share/glc_elevclass_mod.F90
4850 ${SRCROOT} /components/cmeps/cesm/nuopc_cap_share/shr_dust_emis_mod.F90
4951 ${SRCROOT} /components/cmeps/cesm/nuopc_cap_share/shr_expr_parser_mod.F90
5052 ${SRCROOT} /components/cmeps/cesm/nuopc_cap_share/shr_fire_emis_mod.F90
51- )
53+ )
5254
5355# Add CLM source directories
5456add_subdirectory (${CLM_ROOT} /src/utils clm_utils)
@@ -60,6 +62,18 @@ add_subdirectory(${CLM_ROOT}/src/main clm_main)
6062add_subdirectory (${CLM_ROOT} /src/init_interp clm_init_interp)
6163add_subdirectory (${CLM_ROOT} /src/self_tests clm_self_tests)
6264
65+ # Add FATES source directories
66+ # Adding FATES directories is commented out -- because of the problem in:
67+ # https://github.com/ESCOMP/CTSM/issues/3704
68+ # add_subdirectory(${CLM_ROOT}/src/fates/main fates_main)
69+ # add_subdirectory(${CLM_ROOT}/src/fates/biogeochem fates_biogeochem)
70+ # add_subdirectory(${CLM_ROOT}/src/fates/biogeophys fates_biogeophys)
71+ # add_subdirectory(${CLM_ROOT}/src/fates/parteh fates_parteh)
72+ # add_subdirectory(${CLM_ROOT}/src/fates/fire fates_fire)
73+ # add_subdirectory(${CLM_ROOT}/src/fates/radiation fates_radiation)
74+ # NOTE: Need to add the fates library and dependencies below
75+ # ### End add of FATES directories
76+
6377# Add general unit test directories (stubbed out files, etc.)
6478add_subdirectory (unit_test_stubs)
6579add_subdirectory (unit_test_shr)
@@ -69,10 +83,11 @@ add_subdirectory(unit_test_shr)
6983# TODO: this should be moved into a general-purpose function in Sourcelist_utils.
7084# Then each removal could be replaced with a single call, like:
7185# remove_source_file(${share_sources} "shr_mpi_mod.F90")
72- foreach (sourcefile ${share_sources} )
86+ foreach (sourcefile ${share_sources} )
7387 # Remove shr_mpi_mod from share_sources.
7488 # This is needed because we want to use the mock shr_mpi_mod in place of the real one
7589 string (REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile} )
90+
7691 if (match_found)
7792 list (REMOVE_ITEM share_sources ${sourcefile} )
7893 endif ()
@@ -83,6 +98,7 @@ foreach (sourcefile ${share_sources})
8398 # error message, "Cannot open module file 'pio.mod'") on a Mac without a pre-built PIO
8499 # (where ESMF was built with its internal PIO).
85100 string (REGEX MATCH "shr_pio_mod.F90" match_found ${sourcefile} )
101+
86102 if (match_found)
87103 list (REMOVE_ITEM share_sources ${sourcefile} )
88104 endif ()
@@ -101,11 +117,11 @@ include_directories(${SRCROOT}/share/include)
101117
102118# Tell cmake to look for libraries & mod files here, because this is where we built libraries
103119include_directories (${CMAKE_CURRENT_BINARY_DIR} )
104- include_directories (${NETCDF} /include )
120+ include_directories (${NETCDF} /include )
105121
106122# Directories and libraries to include in the link step
107123link_directories (${CMAKE_CURRENT_BINARY_DIR} )
108- link_libraries ( netcdf esmf )
124+ link_libraries (netcdf esmf)
109125
110126# Add the test directories
111127# Note: it's possible that these could be added by each source directory that
@@ -125,4 +141,3 @@ add_subdirectory(${CLM_ROOT}/src/self_tests/test clm_self_tests_test)
125141# Add driver unit test directories
126142# (these should be moved to the appropriate submodule)
127143add_subdirectory (${CLM_ROOT} /src/drv_test drv_test)
128-
0 commit comments