Skip to content

Commit

Permalink
Leverage workaround supplied by https://github.com/mathomp4 for CMake…
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed Nov 14, 2024
1 parent 93a7b1a commit 1568681
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/addon/ESMX/Driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ foreach(ESMX_LINK_LIBRARY IN ITEMS ${ESMX_LINK_LIBRARIES})
endif()
endforeach()

# CMake has a bug with NAG and OpenMP:
# https://gitlab.kitware.com/cmake/cmake/-/issues/21280
# so we work around it ... credit to https://github.com/mathomp4
if (OpenMP_Fortran_FOUND AND CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
message(WARNING "NAG Fortran detected, resetting OpenMP flags to avoid CMake bug")
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_LIBRARIES "")
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_OPTIONS "-openmp")
endif()

# link options
if(DEFINED ESMX_LINK_OPTIONS)
target_link_options(esmx_driver PUBLIC ${ESMX_LINK_OPTIONS})
Expand Down

0 comments on commit 1568681

Please sign in to comment.