summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake40
-rw-r--r--Tests/RunCMake/VS10Project/CustomCommandParallel.cmake5
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake3
-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
10 files changed, 70 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake
new file mode 100644
index 0000000000..87e2f704d2
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/CustomCommandParallel-check.cmake
@@ -0,0 +1,40 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(found_CustomBuild_cmp0147_new 0)
+set(found_CustomBuild_cmp0147_old 0)
+set(found_BuildInParallel_cmp0147_new 0)
+set(found_BuildInParallel_cmp0147_old 0)
+set(in_CustomBuild_cmp0147 "")
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-old\.txt\.rule">]])
+ set(found_CustomBuild_cmp0147_old 1)
+ set(in_CustomBuild_cmp0147 "old")
+ endif()
+ if(line MATCHES [[<CustomBuild Include=".*\\cmp0147-new\.txt\.rule">]])
+ set(found_CustomBuild_cmp0147_new 1)
+ set(in_CustomBuild_cmp0147 "new")
+ endif()
+ if(line MATCHES [[</CustomBuild>]])
+ set(in_CustomBuild_cmp0147 "")
+ endif()
+ if(line MATCHES [[<BuildInParallel .*>true</BuildInParallel>]] AND in_CustomBuild_cmp0147)
+ set(found_BuildInParallel_cmp0147_${in_CustomBuild_cmp0147} 1)
+ endif()
+endforeach()
+if(NOT found_CustomBuild_cmp0147_new)
+ string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n")
+endif()
+if(NOT found_CustomBuild_cmp0147_old)
+ string(APPEND RunCMake_TEST_FAILED "CustomBuild for cmp0147-old.txt.rule not found in\n ${vcProjectFile}\n")
+endif()
+if(NOT found_BuildInParallel_cmp0147_new)
+ string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-new.txt.rule not found in\n ${vcProjectFile}\n")
+endif()
+if(found_BuildInParallel_cmp0147_old)
+ string(APPEND RunCMake_TEST_FAILED "BuildInParallel for cmp0147-old.txt.rule incorrectly found in\n ${vcProjectFile}\n")
+endif()
diff --git a/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake b/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake
new file mode 100644
index 0000000000..784fc685b5
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/CustomCommandParallel.cmake
@@ -0,0 +1,5 @@
+cmake_policy(VERSION 3.26) # CMP0147 left unset
+add_custom_command(OUTPUT "cmp0147-old.txt" COMMAND echo)
+cmake_policy(SET CMP0147 NEW)
+add_custom_command(OUTPUT "cmp0147-new.txt" COMMAND echo)
+add_custom_target(foo DEPENDS "cmp0147-old.txt" "cmp0147-new.txt")
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index ed74896370..669049a737 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -8,6 +8,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_C_COMPILER_VERSION VERSION_GREA
endif()
run_cmake(CustomCommandGenex)
+if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio 1[1-5] ")
+ run_cmake(CustomCommandParallel)
+endif()
run_cmake(VsCsharpSourceGroup)
run_cmake(VsCSharpCompilerOpts)
run_cmake(ExplicitCMakeLists)
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 0000000000..d00491fd7e
--- /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 0000000000..1caf6c592e
--- /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 0000000000..0ca5b6c999
--- /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 0000000000..61ecee5106
--- /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 0000000000..d5f3e91db1
--- /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 0000000000..68a86eedab
--- /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 924aa66578..26eb908f0d 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)