From eda381ada747cfa558c7598f328b0fe517f6d776 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Thu, 16 Oct 2025 09:38:42 -0600 Subject: [PATCH] Improve CMake detection of whether NetCDF is found Without this fix, the build on my Mac finds a netCDFConfig.cmake file (rather than a FindNetCDF.cmake file) that causes entrance into the wrong block. Resolves ESMCI/cprnc#29 Co-authored-by: Luca Bertagna --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b2f112..1a9da76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ endforeach () # Try to find NetCDF dependency. Try standard find_package first. find_package(NetCDF QUIET COMPONENTS C Fortran) -if (NetCDF_FOUND) +if (NetCDF_C_FOUND AND NetCDF_Fortran_FOUND) if(TARGET NetCDF::NetCDF_Fortran) set(CPRNC_NETCDF_FORTRAN_LIB NetCDF::NetCDF_Fortran) set(CPRNC_NETCDF_C_LIB NetCDF::NetCDF_C)