From a4c8a4397703187f2c66e08bc791578deee311da Mon Sep 17 00:00:00 2001 From: stackjohn Date: Thu, 17 Oct 2024 19:43:46 +0100 Subject: [PATCH] Ensure NetCDF and OpenMP are included when building shared lib --- wgrib2/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index 6308b6c..73ac2fb 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -86,6 +86,10 @@ set_target_properties(wgrib2_exe PROPERTIES OUTPUT_NAME wgrib2) if(USE_NETCDF) target_link_libraries(obj_lib PUBLIC NetCDF::NetCDF_C) + if(BUILD_SHARED_LIB) + target_link_libraries(wgrib2_lib PUBLIC NetCDF::NetCDF_C) + target_link_libraries(wgrib2_exe PUBLIC NetCDF::NetCDF_C) + endif() endif() if(USE_PNG) @@ -94,6 +98,9 @@ endif() if(OpenMP_C_FOUND) target_link_libraries(obj_lib PUBLIC OpenMP::OpenMP_C) + if(BUILD_SHARED_LIB) + target_link_libraries(wgrib2_lib PUBLIC OpenMP::OpenMP_C) + endif() endif() if(USE_IPOLATES)