GEOS-ESM / GEOSgcm

GEOS Earth System Model GEOSgcm Fixture
Apache License 2.0
35 stars 11 forks source link

Need to search for uppercase ESMF_ROOT instead of esmf_ROOT in CMakeLists.txt with next spack-stack release #767

Open climbfuji opened 4 months ago

climbfuji commented 4 months ago

WIth spack-stack-1.7.0, we revert to the spack develop version of UPPERCASEPACKAGENAME_ROOT instead of CaseSensitivePackageName_ROOT. This will require changing esmf_ROOT to ESMF_ROOT in `CMakelistst.txt:

https://github.com/GEOS-ESM/GEOSgcm/blob/53409fd14ec9784246dfef7cc1063864bbc15565/CMakeLists.txt#L60

I am surprised to find the spack-stack convention (CaseSensitivePackageName_ROOT) in CMakeLists.txt, since I though GEOS so far didn't use spack-stack. If your build systems also set esmf_ROOT, can you either consider changing those to ESMF_ROOT as well, or check for both esmf_ROOT and ESMF_ROOT inCMakeLists.txt, please?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5e6810..cef7ff7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,9 @@ if (NOT Baselibs_FOUND)
   endif()

   if (NOT TARGET esmf)
-    if (DEFINED ENV{esmf_ROOT})
-      message (STATUS "Found esmf_ROOT in environment: $ENV{esmf_ROOT}")
-      find_path(ESMF_CMAKE_PATH FindESMF.cmake HINTS "$ENV{esmf_ROOT}/cmake")
+         if (DEFINED ENV{ESMF_ROOT})
+                 message (STATUS "Found ESMF_ROOT in environment: $ENV{ESMF_ROOT}")
+                 find_path(ESMF_CMAKE_PATH FindESMF.cmake HINTS "$ENV{ESMF_ROOT}/cmake")
       message (STATUS "Found FindESMF.cmake in: ${ESMF_CMAKE_PATH}")
       if (ESMF_CMAKE_PATH)
         message (STATUS "Appending to CMAKE_PREFIX_PATH: ${ESMF_CMAKE_PATH}")
mathomp4 commented 4 months ago

@climbfuji My guess is this code is pretty much tested by you. I mean, I have built GEOS with mainline Spack and I guess it must be good enough? But you are our main customer for this, so a PR is incoming!