NCAR / wrf_hydro_nwm_public

WRF-Hydro model code
https://ral.ucar.edu/projects/wrf_hydro
Other
181 stars 139 forks source link

Split C/Fortran netCDF installations fails with multiple library directories in CMake #699

Open scrasmussen opened 1 year ago

scrasmussen commented 1 year ago

Expected Behavior

CMake build finds the Fortran NetCDF library when the NetCDF C and Fortran installation are in different directories.

Current Behavior

The line

    find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs}  HINTS "${NetCDF_lib_dirs}" NO_DEFAULT_PATH)

is only searching the path where the C library is installed, but the Fortran NetCDF library is installed is a separate directory.

Possible Solution

Choose one of the following or maybe something else

Steps to Reproduce (for bugs)

  1. On Cheyenne load the JEDI Spack modules
    
    module purge
    export LMOD_TMOD_FIND_FIRST=yes

module use /glade/work/jedipara/cheyenne/spack-stack/modulefiles/misc module load miniconda/3.9.12 module load ecflow/5.8.4 module load mysql/8.0.31

module use /glade/work/epicufsrt/contrib/spack-stack/spack-stack-1.4.0/envs/unified-env-v2/install/modulefiles/Core module load stack-gcc/10.1.0 module load stack-openmpi/4.1.1 module load stack-python/3.9.12 module load jedi-base-env


2. Try and build WRF-Hydro with basic CMake commands: `mkdir build; cd build; cmake ..`

## Your Environment
* Version of the code used: `main` branch
* Operating System and version: Cheyenne
* Compiler and version: GNU 10.1.0
* Other relevant information: Using Spack Modules so NetCDF C and Fortran installations are in different directories
scrasmussen commented 1 year ago

Semi related to issue #683