diff --git a/CMakeLists.txt b/CMakeLists.txt index da99120..ac62e56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,13 +114,7 @@ endif() message(STATUS "Checking if the user want to use OpenMP...") if(USE_OPENMP) - find_package(OpenMP) - if(OpenMP_CXX_FOUND) - target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_CXX) - endif() -# if(OpenMP_Fortran_FOUND) -# target_link_libraries(MyTarget PUBLIC OpenMP::OpenMP_Fortran) -# endif() + find_package(OpenMP REQUIRED COMPONENTS C) endif() message(STATUS "Checking if the user wants to use PNG...") diff --git a/wgrib2/CMakeLists.txt b/wgrib2/CMakeLists.txt index a36e8e6..2bea5cd 100644 --- a/wgrib2/CMakeLists.txt +++ b/wgrib2/CMakeLists.txt @@ -92,7 +92,7 @@ if(USE_PNG) target_link_libraries(obj_lib PUBLIC PNG::PNG) endif() -if(OpenMP_C_FOUND) +if(USE_OPENMP) target_link_libraries(obj_lib PUBLIC OpenMP::OpenMP_C) endif()