FindCUDA: Disallow with CMP0147 under Visual Studio

FindCUDA's custom commands invoke `nvcc`, which invokes `cl`.  Under VS
this is done without a `/FS` flag, so `.pdb` generation races if we
use `BuildInParallel`.  The FindCUDA module has already been removed by
policy CMP0146 after being deprecated since CMake 3.10, so it is
simplest to just disallow this combination of features.

Issue: #24576
This commit is contained in:
Brad King
2023-03-10 12:35:45 -05:00
parent d6353e74b4
commit 7a7793e6d7
8 changed files with 29 additions and 0 deletions

View File

@@ -565,6 +565,13 @@ if(_FindCUDA_CMP0146 STREQUAL "NEW")
message(FATAL_ERROR "The FindCUDA module has been removed by policy CMP0146.")
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio")
cmake_policy(GET CMP0147 _FindCUDA_CMP0147)
if(_FindCUDA_CMP0147 STREQUAL "NEW")
message(FATAL_ERROR "The FindCUDA module does not work in Visual Studio with policy CMP0147.")
endif()
endif()
if(_FindCUDA_testing)
set(_FindCUDA_included TRUE)
return()