FindCUDA: --target-cpu-architecture no longer supported?
Hello, I was recently trying to cross-compile a third party library that depends on CUDA. I normally prefer to cross-compile using the builtin CUDA language support (i.e. specify -DCMAKE_CUDA_COMPILER
and use project(mylib LANGUAGES CUDA)
, but this is a 3rd party library that still depends on FindCUDA.cmake.
My problem is that even after setting the appropriate environment variables (CUDA_PATH
, CUDA_BIN_PATH
and CUDA_TOOLKIT_ROOT
), nvcc
complains about an unknown command line option.
I think the offending line seems to be here: https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindCUDA.cmake#L1338
It defines an argument for nvcc
called --target-cpu-architecture
when cross-compilation is in effect. My version of nvcc
(CUDA version 10.0) complains about this argument, claiming it is not supported. I also tried with CUDA 10.1.
This parameter does not appear under nvcc --help
or the nvcc web page ( https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html ). Perhaps it is obsolete?
In the end, I reworked the 3rd party's CMakeLists.txt
files to use CMake's builtin CUDA support, but I thought it might be worth mentioning.