From 670c7395a2b9c736ee20f3c9e2162808b77428cc Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:37:18 -0400 Subject: [PATCH 1/2] Update for VS2022 17.11 compatibility with CUDA < 12.4 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f3914456..2b51b49e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,11 @@ if(BUILD_CUDA) # This needs to be added *before* we try to enable the CUDA language so CMake's compiler check passes. if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL 1940) string(APPEND CMAKE_CUDA_FLAGS " --allow-unsupported-compiler") + + # This is needed to build with VS2022 17.11+ and CUDA < 12.4. + if (MSVC_VERSION VERSION_GREATER_EQUAL 1941) + add_compile_definitions(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) + endif() endif() enable_language(CUDA) # This will fail if CUDA is not found From 5a264f4fdba7251476636a9a0da8bfb25c859c92 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:43:32 -0400 Subject: [PATCH 2/2] Try again --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b51b49e7..d305e5a3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ if(BUILD_CUDA) # This is needed to build with VS2022 17.11+ and CUDA < 12.4. if (MSVC_VERSION VERSION_GREATER_EQUAL 1941) - add_compile_definitions(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) + string(APPEND CMAKE_CUDA_FLAGS " -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH") endif() endif()