Ensure MKL detection doesn't depend on MKL header files being present.

Apparently, MKL installations don't always include header files. So
detect MKL libraries and headers seperately.
pull/342/head
Duncan Palmer 8 years ago
parent 7f775b6a2d
commit 81afba6306

@ -474,7 +474,7 @@ if (NOT TARGET dlib)
endif()
if (DLIB_USE_MKL_FFT)
if (found_intel_mkl)
if (found_intel_mkl AND found_intel_mkl_headers)
set (dlib_needed_libraries ${dlib_needed_libraries} ${mkl_libraries})
include_directories(${mkl_include_dir})
else()

@ -8,13 +8,14 @@
# attempts to find some other BLAS and LAPACK libraries if you don't have
# the Intel MKL.
#
# blas_found - True if BLAS is available
# lapack_found - True if LAPACK is available
# found_intel_mkl - True is the the Intel MKL library is available
# blas_libraries - link against these to use BLAS library
# lapack_libraries - link against these to use LAPACK library
# mkl_libraries - link against these to use the MKL library
# mkl_include_dir - add to the include path to use the MKL library
# blas_found - True if BLAS is available
# lapack_found - True if LAPACK is available
# found_intel_mkl - True if the Intel MKL library is available
# found_intel_mkl_headers - True if Intel MKL headers are available
# blas_libraries - link against these to use BLAS library
# lapack_libraries - link against these to use LAPACK library
# mkl_libraries - link against these to use the MKL library
# mkl_include_dir - add to the include path to use the MKL library
# setting this makes CMake allow normal looking if else statements
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
@ -22,6 +23,7 @@ SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
SET(blas_found 0)
SET(lapack_found 0)
SET(found_intel_mkl 0)
SET(found_intel_mkl_headers 0)
if (UNIX)
@ -95,7 +97,7 @@ if (UNIX)
find_library(mkl_rt mkl_rt ${mkl_search_path})
mark_as_advanced( mkl_rt )
# if we found the MKL
if (mkl_include_dir AND mkl_rt)
if ( mkl_rt)
set(mkl_libraries ${mkl_rt} )
set(blas_libraries ${mkl_rt} )
set(lapack_libraries ${mkl_rt} )
@ -115,7 +117,7 @@ if (UNIX)
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
# If we found the MKL
if (mkl_include_dir AND mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
set(mkl_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
@ -126,6 +128,10 @@ if (UNIX)
endif()
endif()
if (found_intel_mkl AND mkl_include_dir)
set(found_intel_mkl_headers 1)
endif()
# try to find some other LAPACK libraries if we didn't find the MKL
set(extra_paths
/usr/lib64

Loading…
Cancel
Save