CMake 3.11 Linking CUBLAS



如何在CMake 3.11中正确链接到CUBLAS

特别是,我正在尝试为此代码创建一个CMakeLists文件。

到目前为止的CMakeLists文件:

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(cmake_and_cuda LANGUAGES CXX CUDA)
add_executable(mmul_2 mmul_2.cu)

这给cublas和curand提供了多个"未定义的引用错误"。

找到的解决方案是在CMakeLists文件的末尾添加此行:

target_link_libraries(mmul_2 -lcublas -lcurand)

最新更新