summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-09 15:18:25 (GMT)
committerBrad King <brad.king@kitware.com>2023-08-10 14:00:53 (GMT)
commitd5118ed2e5d386be829869cffb681c38d551deae (patch)
tree489a58beb3f4d8dce853cb8b6d66cc3b2f18e10f /Tests
parent6b21d2bc9bbe241252b5ad30b7a8bb850518638c (diff)
parent89b611ab3232cdeb4892458bf9d6c3281a8fda00 (diff)
downloadCMake-d5118ed2e5d386be829869cffb681c38d551deae.zip
CMake-d5118ed2e5d386be829869cffb681c38d551deae.tar.gz
CMake-d5118ed2e5d386be829869cffb681c38d551deae.tar.bz2
Merge branch 'backport-vs-sdk-selection' into vs-sdk-selection
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionMissing-stderr.txt2
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-stderr.txt19
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-result.txt (renamed from Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-result.txt)0
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionPre2019.cmake (renamed from Tests/RunCMake/GeneratorPlatform/BadVersionPlatform.cmake)0
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported.cmake1
-rw-r--r--Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake67
-rw-r--r--Tests/RunCMake/GeneratorPlatform/VersionExists-check.cmake12
10 files changed, 73 insertions, 51 deletions
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionMissing-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionMissing-stderr.txt
index d82eb0b..41e94f3 100644
--- a/Tests/RunCMake/GeneratorPlatform/BadVersionMissing-stderr.txt
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionMissing-stderr.txt
@@ -6,6 +6,6 @@
given platform specification with
- version=1\.2\.3\.4
+ version=10\.0\.0\.0
field, but no Windows SDK with that version was found\.$
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-stderr.txt
deleted file mode 100644
index d3c62e3..0000000
--- a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-stderr.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
- Generator
-
- Visual Studio [^
-]+
-
- given platform specification (containing a
-
- version=8\.1
-
- field\. The version field is not supported when targeting
-
- Windows 8\.1(
-
- with the Windows 8\.1 SDK installed\.)?|with
-
- version=8\.1
-
- field, but no Windows SDK with that version was found\.)$
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-result.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform-result.txt
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-result.txt
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-stderr.txt
new file mode 100644
index 0000000..649b89d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given platform specification containing a
+
+ version=10\.0
+
+ field\. The value 10\.0 is only supported by VS 2019 and above\.$
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform.cmake b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019.cmake
index 2fc38e5..2fc38e5 100644
--- a/Tests/RunCMake/GeneratorPlatform/BadVersionPlatform.cmake
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionPre2019.cmake
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-result.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-stderr.txt b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-stderr.txt
new file mode 100644
index 0000000..c165267
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given platform specification containing a
+
+ version=1\.2\.3\.4
+
+ field with unsupported value\.$
diff --git a/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported.cmake b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorPlatform/BadVersionUnsupported.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
index 233eb0a..d8965f7 100644
--- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake
@@ -36,12 +36,16 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[4567])( 20[0-9][0-9])?$")
run_cmake(BadFieldUnknown)
set(RunCMake_GENERATOR_PLATFORM "version=")
run_cmake(BadVersionEmpty)
- set(RunCMake_GENERATOR_PLATFORM "version=1.2.3.4")
+ set(RunCMake_GENERATOR_PLATFORM "version=10.0.0.0")
run_cmake(BadVersionMissing)
- set(RunCMake_GENERATOR_PLATFORM "version=8.1")
- run_cmake_with_options(BadVersionPlatform -DCMAKE_SYSTEM_VERSION=8.1)
+ set(RunCMake_GENERATOR_PLATFORM "version=1.2.3.4")
+ run_cmake(BadVersionUnsupported)
- if(NOT RunCMake_GENERATOR MATCHES "^Visual Studio (1[45]) ")
+ if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[45]) ")
+ set(RunCMake_GENERATOR_PLATFORM "version=10.0")
+ run_cmake(BadVersionPre2019)
+ unset(RunCMake_GENERATOR_PLATFORM)
+ else()
set(expect_version "10.0")
set(RunCMake_GENERATOR_PLATFORM "version=${expect_version}")
set(RunCMake_TEST_VARIANT_DESCRIPTION "-${expect_version}")
@@ -61,6 +65,16 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[4567])( 20[0-9][0-9])?$")
file(GLOB kits RELATIVE "${kitsInclude}" "${kitsInclude}/*/um/windows.h")
list(TRANSFORM kits REPLACE "/.*" "")
endif()
+ cmake_host_system_information(RESULT kitsRoot81
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Microsoft/Windows Kits/Installed Roots"
+ VALUE "KitsRoot81"
+ VIEW 64_32
+ ERROR_VARIABLE kitsRoot81Error
+ )
+ if(NOT kitsRoot81Error AND EXISTS "${kitsRoot81}/include/um/windows.h")
+ list(PREPEND kits "8.1")
+ endif()
+
if(kits)
message(STATUS "Available Kits: ${kits}")
if(RunCMake_GENERATOR MATCHES "^Visual Studio 14 ")
@@ -83,29 +97,28 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[4567])( 20[0-9][0-9])?$")
message(FATAL_ERROR "Could not find any Windows SDKs to drive test cases.")
endif()
- if(kits)
- foreach(expect_version IN LISTS kits)
- set(RunCMake_GENERATOR_PLATFORM "version=${expect_version}")
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-${expect_version}")
- run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=10.0)
- unset(RunCMake_GENERATOR_PLATFORM)
- endforeach()
- foreach(expect_version IN LISTS kits)
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMP0149-OLD-${expect_version}")
- run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=${expect_version} -DCMAKE_POLICY_DEFAULT_CMP0149=OLD)
- endforeach()
- if(kits MATCHES "(^|;)([0-9.]+)$")
- set(expect_version "${CMAKE_MATCH_2}")
- foreach(test_version IN LISTS kits)
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMP0149-NEW-${test_version}")
- run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=${test_version} -DCMAKE_POLICY_DEFAULT_CMP0149=NEW)
- endforeach()
- endif()
- foreach(expect_version IN LISTS kits)
- set(RunCMake_TEST_VARIANT_DESCRIPTION "-WindowsSDKVersion-${expect_version}")
- set(ENV{WindowsSDKVersion} "${expect_version}\\")
- run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_POLICY_DEFAULT_CMP0149=NEW)
- unset(ENV{WindowsSDKVersion})
+ foreach(expect_version IN LISTS kits)
+ set(RunCMake_GENERATOR_PLATFORM "version=${expect_version}")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-${expect_version}")
+ run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=10.0)
+ unset(RunCMake_GENERATOR_PLATFORM)
+ endforeach()
+ foreach(expect_version IN LISTS kits)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMP0149-OLD-${expect_version}")
+ run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=${expect_version} -DCMAKE_POLICY_DEFAULT_CMP0149=OLD)
+ endforeach()
+ if(kits MATCHES "(^|;)([0-9.]+)$")
+ set(expect_version "${CMAKE_MATCH_2}")
+ foreach(test_version IN LISTS kits)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMP0149-NEW-${test_version}")
+ run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=${test_version} -DCMAKE_POLICY_DEFAULT_CMP0149=NEW)
endforeach()
endif()
+ list(REMOVE_ITEM kits 8.1)
+ foreach(expect_version IN LISTS kits)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-WindowsSDKVersion-${expect_version}")
+ set(ENV{WindowsSDKVersion} "${expect_version}\\")
+ run_cmake_with_options(VersionExists -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_POLICY_DEFAULT_CMP0149=NEW)
+ unset(ENV{WindowsSDKVersion})
+ endforeach()
endif()
diff --git a/Tests/RunCMake/GeneratorPlatform/VersionExists-check.cmake b/Tests/RunCMake/GeneratorPlatform/VersionExists-check.cmake
index 6c3c8e5..62fb278 100644
--- a/Tests/RunCMake/GeneratorPlatform/VersionExists-check.cmake
+++ b/Tests/RunCMake/GeneratorPlatform/VersionExists-check.cmake
@@ -1,9 +1,13 @@
if(actual_stdout MATCHES "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION='([^']+)'")
set(actual_version "${CMAKE_MATCH_1}")
- if(NOT "${actual_version}" STREQUAL "${expect_version}")
- set(RunCMake_TEST_FAILED "Actual SDK version '${actual_version}' did not match expected '${expect_version}'")
- return()
- endif()
+elseif(actual_stdout MATCHES "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=''" AND RunCMake_GENERATOR MATCHES "Visual Studio 1[45] ")
+ set(actual_version "8.1")
else()
set(RunCMake_TEST_FAILED "No CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION found in output.")
+ return()
+endif()
+
+if(NOT "${actual_version}" STREQUAL "${expect_version}")
+ set(RunCMake_TEST_FAILED "Actual SDK version '${actual_version}' did not match expected '${expect_version}'")
+ return()
endif()