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

make problem for mkl

MXY6
Beginner
825 Views

Hi, recently I build a project using mkl through make, my simple CMakeLists is like this,

cmake_minimum_required(VERSION 3.14)
project(ex5 Fortran)
enable_language(Fortran)

find_package(MKL REQUIRED)
include_directories(${MKL_INCLUDE})

add_executable(ex5 main.f90)
target_link_libraries(ex5 ${MKL_LIBRARIES})
#target_link_options(ex5 PUBLIC $<LINK_ONLY:MKL::MKL>)

If I use target_link_libraries(ex5 ${MKL_LIBRARIES}), I can successfully build the project, but not for

#target_link_options(ex5 PUBLIC $<LINK_ONLY:MKL::MKL>), which shows this error,

ifort: error #10236: File not found: 'MKL::MKL'

could you help solve this? 

0 Kudos
5 Replies
JaideepK_Intel
Moderator
795 Views

Hi,

Thank you for posting in Intel Communities.

We are investigating your issue at our end, Could you please share the mkl version for better understanding.

 

Thanks,

Jaideep

 

0 Kudos
MXY6
Beginner
773 Views

Thanks for your response. My mkl version is 2021.4 for Mac os

 

0 Kudos
VidyalathaB_Intel
Moderator
721 Views

Hi,


Thanks for providing the details.

The issue raised by you is reproducible from our end as well.

We are looking into this issue. We will get back to you soon.


Regards,

Vidya.


0 Kudos
Khang_N_Intel
Employee
676 Views

Hi Meng,


We have tested with oneMKL 2021.4 and confirmed the issue. We have escalated this issue to the MKL team.


We will let you know when we have the solution for this problem.


Best regards

Khang


0 Kudos
Khang_N_Intel
Employee
465 Views

Hi Meng,


cmake function target_link_options inserts the target as is, target_link_libraries should be used in order to resolve MKL target correctly.

Please refer to CMakeLists.txt from oneMKL Fortran examples for the correct way how to include oneMKL to CMake project for classic Fortran API:

<install_path>/oneapi/mkl/2021.4.0/examples/examples_core_f.tgz/f/CMakeLists.txt: 

target_compile_options(${func} PUBLIC ${TEST_COPT} $<TARGET_PROPERTY:MKL::MKL,INTERFACE_COMPILE_OPTIONS>)

target_link_libraries(${func} PUBLIC ${TEST_LOPT} $<LINK_ONLY:MKL::MKL>) 


This should fix it.


Khang


0 Kudos
Reply