Skip to content

Commit

Permalink
Merge pull request #1647 from deslaughter/b/omp-flags
Browse files Browse the repository at this point in the history
Fix adding OpenMP flags to CMAKE_Fortran_FLAGS
  • Loading branch information
deslaughter authored Jun 23, 2023
2 parents 4d038af + fc7d4d3 commit 39f3483
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

#-------------------------------------------------------------------------------
Expand Down

0 comments on commit 39f3483

Please sign in to comment.