Skip to content

Commit ec757e3

Browse files
Merge pull request #646 from E3SM-Project/bartgol/fix-find-ncdf-config
Fix the name of NetCDF config executable for the NetCDF fortran component. Without this fix the NetCDF fortran configure executable is assumed to be nfortran-config (not nf-config) and never found. Fixes #645
2 parents 450fbfc + 650021d commit ec757e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmake/FindNetCDF.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,14 @@ foreach (NCDFcomp IN LISTS NetCDF_FIND_VALID_COMPONENTS)
146146
CHECK_FUNCTION_EXISTS(nc__enddef NetCDF_C_NC__ENDDEF_EXISTS)
147147
endif ()
148148

149-
string(TOLOWER "${NCDFcomp}" ncdfcomp)
149+
if (NCDFcomp STREQUAL "C")
150+
set (config_exe_name nc-config)
151+
else()
152+
set (config_exe_name nf-config)
153+
endif()
150154
find_program(NetCDF_${NCDFcomp}_CONFIG_EXE
151-
NAMES n${ncdfcomp}-config
155+
NAMES ${config_exe_name}
152156
HINTS ${NetCDF_${NCDFcomp}_INCLUDE_DIR}/../bin)
153-
154157
if (NetCDF_${NCDFcomp}_CONFIG_EXE)
155158
message(STATUS "NetCDF_${NCDFcomp}_CONFIG_EXE = ${NetCDF_${NCDFcomp}_CONFIG_EXE}")
156159
execute_process(COMMAND "${NetCDF_${NCDFcomp}_CONFIG_EXE}" "--has-nczarr"

0 commit comments

Comments
 (0)