CMake疑難雜症
Failed to detect a default CUDA architecture或是CMAKE_CUDA_ARCHITECTURES must be non-empty if set
直接告訴CMake nvcc的位置,注意舊的build資料夾要先清掉-DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.7/bin/nvcc
https://www.cnblogs.com/metaz/p/16919028.html
VS code設定cmake的環境變數
在setting.json加入"cmake.environment": {"CUDA_VER":"11.7"}
,說明書:https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-presets.md#ignored-settings
CMake presets: https://dominikberner.ch/cmake-presets-best-practices/
CMake 系統環境變數設置
https://www.scivision.dev/cmake-environment-variable-scope/
libcuda.so.1 not found
使用find_package(CUDAToolkit)
並且在target_link_libraries
加入CUDA::cuda_driver
CMake find_package() 用法
CMake有許多尋找套件的module,例如FindCUDAToolkit
,下面連結條列各種find_package()
能使用的module
https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#manual:cmake-modules(7)