[CMake] enable_language(CUDA) and long command lines on windows
JR Cary
cary at txcorp.com
Sat Apr 6 12:23:48 EDT 2019
Porting our cmake build system to use enable_language(CUDA). This is a
complex
computational application that make use of many libraries. Upon doing this,
add_executable ended up generating a link line of 9455 chars, causing
Windows
cmd to fail to execute it. In addition, the final link used nvcc instead of
cl, as used to be the case, even though the one and only source file is
a cxx
file.
Had a similar problem in creating shared libraries.
So my questions are:
1. How can I force the use of link.exe instead of nvcc.exe with
enable_language(CUDA)?
2. If that does not solve the problem of long link lines, how can I
solve that
with an external file specifying the link, as is done without
enable_language(CUDA)?
Thanks....John Cary
PS: In case anyone finds this of use...
a) I had to remove cudart_static from
CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES to get my windows shared libs to
build, as
they were linking to plain old cudart.
b) To get reconfiguring to work, I had put
set(CMAKE_CUDA_COMPILER_ID_RUN FALSE) # Workaround
before
include(${CMAKE_ROOT}/Modules/CMakeDetermineCUDACompiler.cmake)
to get auto-reconfiguring to work.
More information about the CMake
mailing list