diff --git a/.gitignore b/.gitignore index 5e844f143a4a..f58506891921 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,13 @@ CMakeUserPresets.json # Ignore possible symlinked build and install directories -build-* -install-* +# Note: we can't use a / at the end because they might be +# symlink to a directory +build* +install* + +# If you build with spack libraries, you can get spack log files +spack*.log *.swp *.swo diff --git a/CHANGELOG.md b/CHANGELOG.md index c7907ed679c9..862ce86e3336 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed bug with split restart files - Removed unnecessary memory allocation for tile reads. This is critical for high res runs on SCU17 - Fixes to allow SCM model to run +- Fixed non-Baselibs build using `ESMF::ESMF` target ### Removed diff --git a/CMakeLists.txt b/CMakeLists.txt index d0cbe7caa523..89c3b217e918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,21 +148,8 @@ if (NOT Baselibs_FOUND) endif() if (NOT TARGET ESMF::ESMF) - find_package(ESMF 8.6.0 MODULE REQUIRED) - - # ESMF as used in MAPL requires MPI - # NOTE: This looks odd because some versions of FindESMF.cmake out in the - # world provide an "esmf" target while others provide "ESMF". So we - # need this ugliness to support both. - if (TARGET ESMF::ESMF) - target_link_libraries(ESMF::ESMF INTERFACE MPI::MPI_Fortran) - else() - target_link_libraries(ESMF::ESMF INTERFACE MPI::MPI_Fortran) - # MAPL and GEOS use lowercase target due to historical reasons but - # the latest FindESMF.cmake file from ESMF produces an ESMF target. - add_library(ESMF::ESMF ALIAS ESMF) - add_library(ESMF::ESMF ALIAS esmf) - endif() + find_package(ESMF 8.6.1 MODULE REQUIRED) + target_link_libraries(ESMF::ESMF INTERFACE MPI::MPI_Fortran) endif () else () # This is an ESMF version test when using Baselibs which doesn't use the diff --git a/cmake/FindESMF.cmake b/cmake/FindESMF.cmake index eabba677d3b6..4eb0f6a54e91 100644 --- a/cmake/FindESMF.cmake +++ b/cmake/FindESMF.cmake @@ -96,22 +96,22 @@ if(EXISTS ${ESMFMKFILE}) message(WARNING "Static ESMF library (libesmf.a) not found in \ ${ESMF_LIBSDIR}. Try setting USE_ESMF_STATIC_LIBS=OFF") endif() - if(NOT TARGET ESMF) - add_library(ESMF STATIC IMPORTED) + if(NOT TARGET ESMF::ESMF) + add_library(ESMF::ESMF STATIC IMPORTED) endif() else() find_library(ESMF_LIBRARY_LOCATION NAMES esmf PATHS ${ESMF_LIBSDIR} NO_DEFAULT_PATH) if(ESMF_LIBRARY_LOCATION MATCHES "ESMF_LIBRARY_LOCATION-NOTFOUND") message(WARNING "ESMF library not found in ${ESMF_LIBSDIR}.") endif() - if(NOT TARGET ESMF) - add_library(ESMF UNKNOWN IMPORTED) + if(NOT TARGET ESMF::ESMF) + add_library(ESMF::ESMF UNKNOWN IMPORTED) endif() endif() - # Add target alias to facilitate unambiguous linking - if(NOT TARGET ESMF::ESMF) - add_library(ESMF::ESMF ALIAS ESMF) + # Add ESMF as an alias to ESMF::ESMF for backward compatibility + if(NOT TARGET ESMF) + add_library(ESMF ALIAS ESMF::ESMF) endif() # Add ESMF include directories @@ -135,7 +135,7 @@ if(EXISTS ${ESMFMKFILE}) ESMF_F90COMPILEPATHS VERSION_VAR ESMF_VERSION) - set_target_properties(ESMF PROPERTIES + set_target_properties(ESMF::ESMF PROPERTIES IMPORTED_LOCATION "${ESMF_LIBRARY_LOCATION}" INTERFACE_INCLUDE_DIRECTORIES "${ESMF_INCLUDE_DIRECTORIES}" INTERFACE_LINK_LIBRARIES "${ESMF_INTERFACE_LINK_LIBRARIES}")