summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakeHostSystemInformationCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-24 20:12:31 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-25 16:45:44 (GMT)
commitc46b265839c408ba04edc6ae7c96bc257547f43c (patch)
tree30172385edacef220a835c568e73513ff4ccd4a5 /Source/cmCMakeHostSystemInformationCommand.cxx
parentb610b7a35cd62ce180ef3f5be4fabd9336f3fe51 (diff)
downloadCMake-c46b265839c408ba04edc6ae7c96bc257547f43c.zip
CMake-c46b265839c408ba04edc6ae7c96bc257547f43c.tar.gz
CMake-c46b265839c408ba04edc6ae7c96bc257547f43c.tar.bz2
VS: Add Visual Studio 17 2022 generator
Fixes: #22339
Diffstat (limited to 'Source/cmCMakeHostSystemInformationCommand.cxx')
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index 26e9af0..0550568 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -171,6 +171,22 @@ bool GetValue(cmExecutionStatus& status, cmsys::SystemInformation& info,
if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
cmSystemTools::ConvertToUnixSlashes(value);
}
+ } else if (key == "VS_17_DIR") {
+ // If generating for the VS 17 IDE, use the same instance.
+ cmGlobalGenerator* gg = status.GetMakefile().GetGlobalGenerator();
+ if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 17 ")) {
+ cmGlobalVisualStudioVersionedGenerator* vs17gen =
+ static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
+ if (vs17gen->GetVSInstance(value)) {
+ return true;
+ }
+ }
+
+ // Otherwise, find a VS 17 instance ourselves.
+ cmVSSetupAPIHelper vsSetupAPIHelper(17);
+ if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
+ cmSystemTools::ConvertToUnixSlashes(value);
+ }
#endif
} else {
std::string e = "does not recognize <key> " + key;