link MKL libraries in Windows / Clion /Cmake


I am very new in CMake and I am trying to include MKL libraries in my project done in Clion. Compiler is MVS 2019 as required.

Using MKL tool I get the following information:

use this link line:  mkl_intel_ilp64_dll.lib mkl_tbb_thread_dll.lib mkl_core_dll.lib tbb.lib
compiler options:  /DMKL_ILP64 -I"%MKLROOT%"\include

My best knowledge of CMake allowed me to try the following:

set(MKL_DIR "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.3.279/windows/mkl/lib/intel64_win")
target_link_libraries(project_x PRIVATE "${MKL_DIR}/mkl_intel_lp64")

but of course when I tried to check if it finds the library:

find_library(MKL_LIB mkl_intel_lp64)
    message(FATAL_ERROR "mkl library not found")

the results are disappointing. Kindly advise how could I properly do this in Windows / Clion IDE

Thank You,

You’re probably missing a .lib on the end of this at least.

Should probably be:

find_library(MKL_LIB NAMES mkl_intel_lp64 PATHS ${MKL_DIR})