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.
This commit is contained in:
Duncan Palmer 2016-11-28 16:07:14 +10:00
parent 7f775b6a2d
commit 81afba6306
2 changed files with 16 additions and 10 deletions

View File

@ -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()

View File

@ -10,7 +10,8 @@
#
# 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
# 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
@ -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