我正在尝试运行英特尔数学内核库(mkl)。有一个工具 ( https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor ) 可以打印必要的、依赖于环境的 cmd 命令,以便将其用于 C++ 脚本。对我来说,它说:
使用此链接行: ${MKLROOT}/lib/libmkl_intel_lp64.a ${MKLROOT}/lib/libmkl_intel_thread.a ${MKLROOT}/lib/libmkl_core.a -liomp5 -lpthread -lm -ldl
编译器选项: -m64 -I${MKLROOT}/include
我的目标是在 CMake 脚本中编写它。我哪里错了/我必须写什么才能完成这项工作?
cmake_minimum_required(VERSION 3.15)
project(PSD_Projections)
set(CMAKE_CXX_STANDARD 14)
set(MKL_DIR /opt/intel/mkl)
# Part for the linker line
# This seems to be somewhat okay
# However I can't figure out what to do about the other linker line arguments
find_library(LIB1 mkl_intel_lp64 ${MKL_DIR}/lib)
find_library(LIB2 mkl_intel_thread ${MKL_DIR}/lib)
find_library(LIB3 mkl_core ${MKL_DIR}/lib)
link_libraries(${LIB1} ${LIB2} ${LIB3})
# Part for the compiler options.
# ${MKL_DIR}/include is found and exists
# I don't know what to do about the -m64
include_directories(${MKL_DIR}/include)
add_executable(PSD_Projections main.cpp)