When using CMake 3.26.4 with CUDA v12.1 and Visual 16.11.25 and compiling a .cu file,
I get the following error:
1>nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified
Here are some relevant CMake parts:
enable_language(CUDA)
add_library(${project} SHARED)
set_target_properties(${project} PROPERTIES CXX_STANDARD 17)
if (MSVC)
target_compile_definitions(${project} PUBLIC -DBOOST_ASIO_DISABLE_CONCEPTS)
target_compile_options(${project} PRIVATE /std:c++latest /await:strict /bigobj "/Zc:__cplusplus")
endif()
find_package(CUDAToolkit)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_60")
target_link_libraries(${project} PRIVATE CUDA::cuda_driver)
set_property(TARGET ${project} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
It looks like NVCC doesn't like any of the / flags that are passed from the CXX compiler.
Tried:
set(CUDA_PROPAGATE_HOST_FLAGS FALSE). Probably deprecatedTried: Removing the
target_compile_optionsand useadd_compile_optionswith$<$<COMPILE_LANGUAGE:CXX>...
Any hint? Thanks!