Skip to content

Commit aeae37e

Browse files
committed
CMake: Demote the mixed linkage check to warning
1 parent 06c09de commit aeae37e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cmake/system.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,15 @@ if (USE_OPENMP)
418418
if (NOT NOFORTRAN)
419419
find_package(OpenMP COMPONENTS Fortran REQUIRED)
420420
# Avoid mixed OpenMP linkage
421-
get_target_property(OMP_C_LIB OpenMP::OpenMP_C INTERFACE_LINK_LIBRARIES)
422-
get_target_property(OMP_Fortran_LIB OpenMP::OpenMP_Fortran INTERFACE_LINK_LIBRARIES)
423-
if (NOT OMP_C_LIB STREQUAL OMP_Fortran_LIB)
424-
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.")
421+
get_target_property(OMP_C_LIBS OpenMP::OpenMP_C INTERFACE_LINK_LIBRARIES)
422+
get_target_property(OMP_F_LIBS OpenMP::OpenMP_Fortran INTERFACE_LINK_LIBRARIES)
423+
if (NOT OMP_C_LIBS STREQUAL OMP_F_LIBS)
424+
message(WARNING
425+
"OpenMP runtimes detected:\n"
426+
" C=${OMP_C_LIBS},\n"
427+
" Fortran=${OMP_F_LIBS}.\n"
428+
"Please check that they are the same OpenMP runtime implementation."
429+
)
425430
endif()
426431
endif ()
427432
endif ()

0 commit comments

Comments
 (0)