FindBLAS: Select MKL threading layer based on the OpenMP runtime library

Fixes: #28072
This commit is contained in:
Ye Luo
2026-09-07 10:39:21 -04:00
committed by Brad King
parent e4a3ef7f8b
commit f49e24f150
+4 -2
View File
@@ -507,11 +507,13 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
else()
set(BLAS_mkl_INTFACE "intel")
endif()
# Switch to GNU libgomp ABI regarding the OpenMP runtime (but not on Apple, where MKL does not provide it).
if(CMAKE_Fortran_COMPILER_LOADED AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "LCC") AND NOT APPLE)
# Switch to GNU libgomp ABI regarding the OpenMP runtime.
if(OpenMP_FOUND AND NOT OpenMP_iomp5_LIBRARY)
# Most OpenMP runtime libraries claim to support drop-in replacement of libgomp.
set(BLAS_mkl_THREADING "gnu")
set(BLAS_mkl_OMP "gomp")
else()
# Safe to select Intel OpenMP runtime when compiler doesn't directly enable OpenMP or the runtime found was already iomp5.
set(BLAS_mkl_THREADING "intel")
set(BLAS_mkl_OMP "iomp5")
endif()