# link MKL libraries in Windows / Clion /Cmake

**URL:** https://discourse.cmake.org/t/link-mkl-libraries-in-windows-clion-cmake/2046
**Category:** Usage
**Tags:** os:windows
**Created:** [October 22, 2020, 4:26pm UTC](https://discourse.cmake.org/t/link-mkl-libraries-in-windows-clion-cmake/2046 "2020-10-22T16:26:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ragnarokas](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ragnarokas/32/904_2.png) [@ragnarokas](https://discourse.cmake.org/u/ragnarokas)
#### Post date: [October 22, 2020, 4:26pm UTC](https://discourse.cmake.org/t/link-mkl-libraries-in-windows-clion-cmake/2046/1 "2020-10-22T16:26:23Z")

</div>

0

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 [https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html](https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-link-line-advisor.html) I get the following information:

```auto
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:

```auto
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:

```auto
find_library(MKL_LIB mkl_intel_lp64)
if(NOT MKL_LIB)
    message(FATAL_ERROR "mkl library not found")
endif()

```

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

Thank You,

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 4, 2021, 6:32pm UTC](https://discourse.cmake.org/t/link-mkl-libraries-in-windows-clion-cmake/2046/2 "2021-01-04T18:32:36Z")

</div>

> [@ragnarokas](#):
>
> ```auto
> target_link_libraries(project_x PRIVATE "${MKL_DIR}/mkl_intel_lp64")
> 
> ```

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

> [@ragnarokas](#):
>
> ```auto
> find_library(MKL_LIB mkl_intel_lp64)
> 
> ```

Should probably be:

```cmake
find_library(MKL_LIB NAMES mkl_intel_lp64 PATHS ${MKL_DIR})

```
