summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-10 17:35:45 (GMT)
committerBrad King <brad.king@kitware.com>2023-03-12 11:52:15 (GMT)
commit7a7793e6d7a230b3c208319dce337c6eec54897a (patch)
tree4cf534118e8c9bee47c4d031a619844f3f2124bc /Tests
parentd6353e74b4dc53b98943d5d66ab5ffb0bef04d08 (diff)
downloadCMake-7a7793e6d7a230b3c208319dce337c6eec54897a.zip
CMake-7a7793e6d7a230b3c208319dce337c6eec54897a.tar.gz
CMake-7a7793e6d7a230b3c208319dce337c6eec54897a.tar.bz2
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
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/find_package/CMP0147-NEW-result.txt1
-rw-r--r--Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt7
-rw-r--r--Tests/RunCMake/find_package/CMP0147-NEW.cmake2
-rw-r--r--Tests/RunCMake/find_package/CMP0147-OLD.cmake2
-rw-r--r--Tests/RunCMake/find_package/CMP0147-WARN.cmake2
-rw-r--r--Tests/RunCMake/find_package/CMP0147-common.cmake3
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake5
7 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/CMP0147-NEW-result.txt b/Tests/RunCMake/find_package/CMP0147-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt
new file mode 100644
index 0000000..1caf6c5
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-NEW-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at [^
+]*/Modules/FindCUDA.cmake:[0-9]+ \(message\):
+ The FindCUDA module does not work in Visual Studio with policy CMP0147\.
+Call Stack \(most recent call first\):
+ CMP0147-common\.cmake:[0-9]+ \(find_package\)
+ CMP0147-NEW\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/CMP0147-NEW.cmake b/Tests/RunCMake/find_package/CMP0147-NEW.cmake
new file mode 100644
index 0000000..0ca5b6c
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0147 NEW)
+include(CMP0147-common.cmake)
diff --git a/Tests/RunCMake/find_package/CMP0147-OLD.cmake b/Tests/RunCMake/find_package/CMP0147-OLD.cmake
new file mode 100644
index 0000000..61ecee5
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0147 OLD)
+include(CMP0147-common.cmake)
diff --git a/Tests/RunCMake/find_package/CMP0147-WARN.cmake b/Tests/RunCMake/find_package/CMP0147-WARN.cmake
new file mode 100644
index 0000000..d5f3e91
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-WARN.cmake
@@ -0,0 +1,2 @@
+# leave CMP0147 unset
+include(CMP0147-common.cmake)
diff --git a/Tests/RunCMake/find_package/CMP0147-common.cmake b/Tests/RunCMake/find_package/CMP0147-common.cmake
new file mode 100644
index 0000000..68a86ee
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0147-common.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0146 OLD)
+set(_FindCUDA_testing TRUE)
+find_package(CUDA MODULE)
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 924aa66..26eb908 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -42,6 +42,11 @@ run_cmake(CMP0145-NEW)
run_cmake(CMP0146-OLD)
run_cmake(CMP0146-WARN)
run_cmake(CMP0146-NEW)
+if(RunCMake_GENERATOR MATCHES "Visual Studio")
+ run_cmake(CMP0147-OLD)
+ run_cmake(CMP0147-WARN)
+ run_cmake(CMP0147-NEW)
+endif()
run_cmake(WrongVersionRange)
run_cmake(EmptyVersionRange)
run_cmake(VersionRangeWithEXACT)