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)