From aadde2aaf772967b41e461516093cb6a30771a51 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal <mathieu.westphal@kitware.com> Date: Fri, 28 Feb 2025 13:17:55 +0100 Subject: [PATCH] CMake: Fix HAVE_LIBGRIB_API and HAVE_LIBGRIB compile definition --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d444fec2..634242393 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,9 @@ endif() # enable default internal libs option(CDI_LIBGRIB "GRIB support [default=ON]" ON) if(${CDI_LIBGRIB}) - list(APPEND cdi_compile_defs HAVE_LIBGRIB=1) + list(APPEND cdi_compile_defs + HAVE_LIBGRIB=1 + HAVE_LIBGRIB_API=1) endif() option(CDI_LIBGRIBEX "Use the CGRIBEX library [default=ON]" ON) @@ -50,8 +52,6 @@ option(CDI_ECCODES "Use the eccodes library [default=ON]" ON) if(${CDI_ECCODES} OR eccodes_ROOT) find_package(eccodes) if (${eccodes_FOUND}) - list(APPEND cdi_compile_defs HAVE_LIBGRIB_API=${eccodes_FOUND}) - message(VERBOSE "added compile definition HAVE_LIBGRIB_API=${eccodes_FOUND}") list(APPEND cdi_linked_libs eccodes) else() message(WARNING "eccodes not found, compiling without eccodes") @@ -67,8 +67,6 @@ if(${CDI_NETCDF} OR netCDF_ROOT ) HAVE_LIBNETCDF=${netCDF_FOUND} HAVE_LIBNC_DAP=${netCDF_FOUND} HAVE_NETCDF4=${netCDF_FOUND} - HAVE_LIBGRIB_API=${netCDF_FOUND} - HAVE_LIBGRIB=${netCDF_FOUND} ) list(APPEND cdi_linked_libs netCDF::netcdf) else() -- GitLab