[CMake] How to link Intel MKL

Bill Hoffman bill.hoffman at kitware.com
Sat Nov 21 09:29:09 EST 2009


> 
> I have changed cmake configuration to link shared libraries of Intel 
> MKL, as following:
> 
> "
> find_package(MKL REQUIRED)
> include_directories(${MKL_INCLUDE_DIRS})
> link_directories(${MKL_LIBRARIES})
> target_link_libraries(<module>
>     mkl_intel_lp64
>     mkl_sequential
>     mkl_core
> )
> "
> and it worked.
> 
> PS: I have written a simplie FindMKL.cmake.
> 
You should be using full paths to mkl_* libraries using find_library.
link_directories is not really a good way to do things.  CMake works
better when it knows exactly what files you are linking to.  For example
if mkl_core were updated on your machine with your code it would not
cause a relink.   Anyway, glad it is working for you.

-Bill




More information about the CMake mailing list