From fd8f0d4f8cee502ef3776b523eaee86dd8b1b765 Mon Sep 17 00:00:00 2001 From: Ruiyang Wu Date: Sun, 31 Aug 2025 22:21:01 -0400 Subject: [PATCH 1/2] CMake: Demote the OpenMP mixed linkage check to NOTICE --- cmake/system.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/system.cmake b/cmake/system.cmake index bf4c548b92..11ebb529e3 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -418,10 +418,15 @@ 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 + "OpenMP runtimes detected:\n" + "C=${OMP_C_LIBS}\n" + "Fortran=${OMP_F_LIBS}\n" + "Please check that they are the same OpenMP runtime implementation." + ) endif() endif () endif () From ed6c223105a8c005d6fe3f14b2f93eade3b3c48d Mon Sep 17 00:00:00 2001 From: Ruiyang Wu Date: Mon, 1 Sep 2025 22:33:52 -0400 Subject: [PATCH 2/2] CMake: Improve the wording of the OpenMP mixed linkage check --- cmake/system.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/system.cmake b/cmake/system.cmake index 11ebb529e3..c085bceef8 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -422,10 +422,11 @@ if (USE_OPENMP) get_target_property(OMP_F_LIBS OpenMP::OpenMP_Fortran INTERFACE_LINK_LIBRARIES) if (NOT OMP_C_LIBS STREQUAL OMP_F_LIBS) message(NOTICE - "OpenMP runtimes detected:\n" + "CMake detected different OpenMP libraries for C and Fortran:\n" "C=${OMP_C_LIBS}\n" "Fortran=${OMP_F_LIBS}\n" - "Please check that they are the same OpenMP runtime implementation." + "In case you encounter issues, please check that this is correct.\n" + "You may pass -DOpenMP__LIB_NAMES and -DOpenMP__LIBRARY to cmake to manually force the OpenMP library." ) endif() endif ()