summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-21 16:17:37 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-29 15:52:58 (GMT)
commit195d47e2139171cbae18a7164daac1f59be54ebe (patch)
treebc5958112b1a0998f87258c57fb8bbb1e06a64b6 /Tests
parentec8d37b3b1ca10535e219b37cf4889d59b1dfedb (diff)
downloadCMake-195d47e2139171cbae18a7164daac1f59be54ebe.zip
CMake-195d47e2139171cbae18a7164daac1f59be54ebe.tar.gz
CMake-195d47e2139171cbae18a7164daac1f59be54ebe.tar.bz2
VS: Allow CMAKE_GENERATOR_INSTANCE to specify portable instance
Previously the `CMAKE_GENERATOR_INSTANCE` value was used only to filter the instances reported by the Visual Studio Installer tool. If the specified install location is not known to the VS Installer, but the user provided a `version=` field, check for the installation directly on disk. Fixes: #21639, #22197
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt13
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake3
4 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
new file mode 100644
index 0000000..baa17aa
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ [^
+]+/Tests/RunCMake/GeneratorInstance
+
+ The directory exists, but the instance is not known to the Visual Studio
+ Installer, and no 'version=' field was given\.$
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
index cdcaac8..dfcdcf8 100644
--- a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
@@ -32,6 +32,9 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[56789])")
set(RunCMake_GENERATOR_INSTANCE "${default_instance},version=${vs_major}.999.99999.999")
run_cmake(WrongVersion)
endif()
+
+ set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}")
+ run_cmake(PortableNoVersion)
else()
set(RunCMake_GENERATOR_INSTANCE "")
run_cmake(NoInstance)