[CMake] enable_language(CUDA) and long command lines on windows

JR Cary cary at txcorp.com
Mon Apr 8 10:51:29 EDT 2019


Regarding the previous email, below....

The method of library construction is to first create an
object library with

add_library(${libname}obj OBJECT ${${LIBNAME}_SOURCES} 
${${LIBNAME}_CUDASRCS})

then to create the actual library with

add_library(${libname} $<TARGET_OBJECTS:${libname}obj>)

and I have tried setting:

set_target_properties(${libname} PROPERTIES LINKER_LANGUAGE CXX)

Thx....John Cary

 > 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)?



More information about the CMake mailing list