NOAA-EMC / CMakeModules

Common cmake module files used by spack and cmake to find dependencies
Other
4 stars 14 forks source link

FindESMF: Setting ESMFMKFILE to non-existent file should report error #56

Open DusanJovic-NOAA opened 3 years ago

DusanJovic-NOAA commented 3 years ago

If ESMFMKFILE environment variable is set but points to a non-existent file, FindESMF silently returns even if in the application it is marked as required package. This fatal error message:

  if (NOT DEFINED ESMFMKFILE)                                                                             
    message(FATAL_ERROR "ESMFMKFILE not defined. This is the path to esmf.mk file. \
Without this filepath, ESMF_FOUND will always be FALSE.")
  endif ()

should depend on whether or not file that ESMFMKFILE points to exists, not whether variable ESMFMKFILE is defined.

DusanJovic-NOAA commented 3 years ago

At the end of FindESMF.cmake we should add something like:

# Check package has been found correctly
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  ESMF
  REQUIRED_VARS
    esmf_lib
  VERSION_VAR ESMF_VERSION_STRING
) 
kgerheiser commented 3 years ago

The CMakeModules you are looking at is out of date. find_package_handle_standard_args is there, though the original bug still exists, but it would fail because the vars aren't set.