Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

MKL and CMAKELIST

zidane__ali
Beginner
2,788 Views

I'm trying to link the mkl library that is included in the parallel studio xe 2019 package to a solution of a project using CMakeLists.txt, I'm getting the following error :

CMake Error at CMakeLists.txt:12 (find_package):
  By not providing "FindMKL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "MKL", but
  CMake did not find one

My CMakeLists.txt file looks like that:

cmake_minimum_required(VERSION 3.15)

project(untitled) set(CMAKE_CXX_STANDARD 14)

add_executable(untitled main.cpp)

set(MKL_DIR "/home/ali/intel/parallel_studio_xe_2019.5.075/compilers_and_libraries_2019/linux/mkl/") include_directories(SYSTEM ${MKL})

find_package(MKL REQUIRED)

if(MKL_FOUND)

include_directories(${MKL_INCLUDE_DIRS})

target_link_libraries(untitled ${MKL_CORE_LIBRARY})

else() message(WARNING "MKL libs not found")

endif()

Thank you

0 Kudos
2 Replies
Jonghak_K_Intel
Employee
2,788 Views

Hi Ali, 

 

I think in order to use CMake for MKL , you would need to provide FindMKL module. 

you may refer this custom FindMKL module and try to provide one that suites your environment. 

https://gist.github.com/scivision/5108cf6ab1515f581a84cd9ad1ef72aa ;

 

also please refer this Link Line Advisor as well. 

https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor

0 Kudos
zidane__ali
Beginner
2,788 Views

Thank you Jon, unfortunately still not working, i keep getting an error "fatal error: mkl_pardiso.h: No such file or directory"

This means the findmkl module couldn't link the solution to the mkl library. For reference i've attached the cmakelist file.

 

0 Kudos
Reply