Open JakubOchnik opened 2 weeks ago
Hi @JakubOchnik
Thanks for your detailed report.
I suspect it has something to do with CMAKE_POLICY_DEFAULT_CMP0091="NEW" and runtime option - it looks like it's not propagated properly. Is there any way to work around this issue?
Could you please check this? If you could remove the CMAKE_POLICY_DEFAULT_CMP0091
both from the CMakePresets.json
and conan_toolchain.cmake
generated files before calling cmake --preset
to check if it works, then do the same with the runtime-option
(btw, what is this runtime option?)
Maybe @jcar87 who has more experience than me with CUDA could help too.
Thanks for looking into it, @memsharded!
It worked after removing the runtime library-related code from generated conan_toolchain.cmake
.
After some trial and error, it turned out that the minimal set of changes that solves the CUDA configuration failure is removing setting the runtime with CMAKE_MSVC_RUNTIME_LIBRARY
from conan_toolchain.cmake
:
set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$<CONFIG:Release>:MultiThreadedDLL>")
So I tried to just use regular CMake with this option, and voila, it failed again.
CMakeLists.txt
:
cmake_minimum_required(VERSION 3.23)
set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$<CONFIG:Release>:MultiThreadedDLL>")
project(dummy VERSION 0.1.0 LANGUAGES CXX CUDA)
cmake .
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.26100.
-- The CXX compiler identification is MSVC 19.41.34123.0
-- The CUDA compiler identification is NVIDIA 12.6.77
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCUDACompiler.cmake:59 (message):
The CUDA compiler
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe"
is not able to compile a simple test program.
...
"C:\Users\Jakub\Desktop\Development\dummy_cuda\CMakeFiles\CMakeScratch\TryCompile-7m8wyt\cmTC_554e7.vcxproj" (default target) (1) ->
(AddCudaCompileMetadata target) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.6.targets(277,17): error MSB4023: Cannot evaluate the item metadata "%()". Parameter "metadataName" cannot have zero length. [C:\Users\Jakub\Desktop\Development\dummy_cuda\CMakeFiles\CMakeScratch\TryCompile-7m8wyt\cmTC_554e7.vcxproj]
...
So it looks like an incompatibility between CMake and Visual Studio CUDA integration.
Is there any way to disable setting the CMAKE_MSVC_RUNTIME_LIBRARY
in conan CMake toolchain (e.g. via conanfile.py
)?
What is your question?
What is your question? I'm developing a CUDA project using conan, CMake and MSVC build tools. After update from CUDA 11.x to CUDA 12.6, any project using conan CMake toolchain fails to configure during CUDA compiler test. It also reproduces in my more complex project GitHub actions Windows build job (example).
The problematic line in
CUDA 12.6.targets
is the following:I suspect it has something to do with
CMAKE_POLICY_DEFAULT_CMP0091="NEW"
and runtime option - it looks like it's not propagated properly. Is there any way to work around this issue?Environment details
conanfile.py:
CMakeLists.txt:
Steps to reproduce:
conan install . -s build_type=Release --build=missing
cmake --preset conan-default
CMake without conan toolchain works fine.
cmake .
Have you read the CONTRIBUTING guide?