CMP0091 policy incompatible with CUDA
Using the new policy, configuring a project to use CXX and CUDA as languages is not possible when specifying a runtime library. An example for a CMakeLists.txt exhibiting this issue:
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
project(Test LANGUAGES CXX CUDA)
Compilers:
The CXX compiler identification is MSVC 19.21.27702.2 The CUDA compiler identification is NVIDIA 10.1.105
Error message:
[cmake] Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe
[cmake] CMake Error in C:/tmp/test/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
[cmake] MSVC_RUNTIME_LIBRARY value 'MultiThreadedDebugDLL' not known for this CUDA
[cmake] compiler.
The documentation says, that compilers targeting the MSVC ABI will reject unsupported values, since for host code nvcc is only a wrapper, it should however be able to support this option in order to properly link program.
Using the "" value for CMAKE_MSVC_RUNTIME_LIBRARY works, however this means we are back to square one regarding support for configuration of MSVC runtime libraries when also using CUDA.
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
set(CMAKE_MSVC_RUNTIME_LIBRARY "")
project(Test LANGUAGES CXX CUDA)
Setting the target property to an executable built from "cpp" files and linking against a library built from "cu" files results in the same error. Propagation should probably work by appending the appropriate flags to the -Xcompiler and / or -Xlinker options for nvcc.