From a7a7acd362d90b39989415e3acb027766d6add84 Mon Sep 17 00:00:00 2001 From: Eric Engle Date: Mon, 23 Oct 2023 22:01:23 -0400 Subject: [PATCH] Update for src/CMakeLists.txt Added logic to link to OpenMP library. This commit references NOAA-EMC/NCEPLIBS-g2c#453 --- src/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ffe9e632..afe7dd72 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,6 +62,17 @@ if(BUILD_STATIC_LIBS) target_include_directories(${lib_name}_static PRIVATE "${LIBXML2_INCLUDE_DIR}") endif() +# Link to OpenMP. +if(OPENMP) + target_link_libraries(${lib_name}_objlib PUBLIC OpenMP::OpenMP_C) + if(BUILD_SHARED_LIBS) + target_link_libraries(${lib_name}_shared PUBLIC OpenMP::OpenMP_C) + endif() + if(BUILD_STATIC_LIBS) + target_link_libraries(${lib_name}_static PUBLIC OpenMP::OpenMP_C) + endif() +endif() + # Build with PNG. if(PNG_FOUND) message(STATUS "PNG include directories ${PNG_INCLUDE_DIR}")