Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cmake's FindMKL to avoid runtime issues and preloading libraries #1427

Merged
merged 2 commits into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cmake/FindMKL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ find_library(MKL_CORE_LIB
PATHS ${MKLSEARCHPATHS}
NO_DEFAULT_PATH)

if (MKL_IFACE_LIB AND MKL_SEQ_LIB AND MKL_CORE_LIB)
set(MKL_LIBRARIES ${MKL_IFACE_LIB} ${MKL_SEQ_LIB} ${MKL_CORE_LIB})
find_library(MKL_RT_LIB
NAMES mkl_rt libmkl_rt mkl_rt_dll
PATHS ${MKLSEARCHPATHS}
NO_DEFAULT_PATH)

if (MKL_IFACE_LIB AND MKL_SEQ_LIB AND MKL_CORE_LIB AND MKL_RT_LIB)
set(MKL_LIBRARIES ${MKL_RT_LIB} ${MKL_IFACE_LIB} ${MKL_SEQ_LIB} ${MKL_CORE_LIB})
else()
set(MKL_LIBRARIES "")
set(MKL_INCLUDE_DIRS "")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKL DEFAULT_MSG
MKL_LIBRARIES MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB) # MKL_INCLUDE_DIRS)
MKL_LIBRARIES MKL_RT_LIB MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB) # MKL_INCLUDE_DIRS)
mark_as_advanced(
MKL_INCLUDE_DIRS MKL_LIBRARIES MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB)
MKL_INCLUDE_DIRS MKL_LIBRARIES MKL_RT_LIB MKL_IFACE_LIB MKL_SEQ_LIB MKL_CORE_LIB)