Browse Source

Merge ed6c223105 into c31861ea62

pull/5434/merge
Ruiyang Wu GitHub 8 months ago
parent
commit
01ab5e059c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      cmake/system.cmake

+ 10
- 4
cmake/system.cmake View File

@@ -418,10 +418,16 @@ if (USE_OPENMP)
if (NOT NOFORTRAN)
find_package(OpenMP COMPONENTS Fortran REQUIRED)
# Avoid mixed OpenMP linkage
get_target_property(OMP_C_LIB OpenMP::OpenMP_C INTERFACE_LINK_LIBRARIES)
get_target_property(OMP_Fortran_LIB OpenMP::OpenMP_Fortran INTERFACE_LINK_LIBRARIES)
if (NOT OMP_C_LIB STREQUAL OMP_Fortran_LIB)
message(FATAL_ERROR "Multiple OpenMP runtime libraries detected. Mixed OpenMP runtime linkage is dangerous. You may pass -DOpenMP_LANG_LIB_NAMES and -DOpenMP_omp_LIBRARY to manually choose the OpenMP library.")
get_target_property(OMP_C_LIBS OpenMP::OpenMP_C INTERFACE_LINK_LIBRARIES)
get_target_property(OMP_F_LIBS OpenMP::OpenMP_Fortran INTERFACE_LINK_LIBRARIES)
if (NOT OMP_C_LIBS STREQUAL OMP_F_LIBS)
message(NOTICE
"CMake detected different OpenMP libraries for C and Fortran:\n"
"C=${OMP_C_LIBS}\n"
"Fortran=${OMP_F_LIBS}\n"
"In case you encounter issues, please check that this is correct.\n"
"You may pass -DOpenMP_<lang>_LIB_NAMES and -DOpenMP_<libname>_LIBRARY to cmake to manually force the OpenMP library."
)
endif()
endif ()
endif ()


Loading…
Cancel
Save