From fc7d4d3acee0ba44e6a9f34c82fe26dd220d3b9c Mon Sep 17 00:00:00 2001 From: Derek Slaughter Date: Fri, 23 Jun 2023 20:51:09 +0000 Subject: [PATCH] Fix adding OpenMP flags to CMAKE_Fortran_FLAGS The last revision had the incorrect case for the CMake variable, so the flag wasn't being added --- CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a8792b190..c560489026 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,10 +108,18 @@ include(${CMAKE_SOURCE_DIR}/cmake/set_rpath.cmake) if (OPENMP OR BUILD_FASTFARM OR BUILD_OPENFAST_CPP_API) FIND_PACKAGE(OpenMP REQUIRED) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - set(CMAKE_FORTRAN_FLAGS "${CMAKE_FORTRAN_FLAGS} ${OpenMP_FORTRAN_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") + if (OpenMP_Fortran_FOUND) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") + link_libraries("${OpenMP_Fortran_LIBRARIES}") + endif() + if (OpenMP_C_FOUND) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + link_libraries("${OpenMP_C_LIBRARIES}") + endif() + if (OpenMP_CXX_FOUND) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + link_libraries("${OpenMP_CXX_LIBRARIES}") + endif() endif() #-------------------------------------------------------------------------------