summaryrefslogtreecommitdiffstats
path: root/Source/cmCMakeHostSystemInformationCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-09 19:30:10 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-11 16:04:51 (GMT)
commit57e48f16f2c3b73fb27057267c8092a41005bb75 (patch)
treea4ffcf1bb1bcb8186ca7504cadd1ad5618852f50 /Source/cmCMakeHostSystemInformationCommand.cxx
parentbdef729646a5a559c295ef9c0fb83eb8a6b34905 (diff)
downloadCMake-57e48f16f2c3b73fb27057267c8092a41005bb75.zip
CMake-57e48f16f2c3b73fb27057267c8092a41005bb75.tar.gz
CMake-57e48f16f2c3b73fb27057267c8092a41005bb75.tar.bz2
VS: Add Visual Studio 16 2019 generator
Add this generator *without* support for specifying the target architecture in the generator name. cmake-gui will be taught to provide a field for this, and command-line builds can use -A. Also, teach this generator to select a default target architecture based on the host architecture. Fixes: #18689 Inspired-by: Egor Pugin <egor.pugin@gmail.com>
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 ddc32c0..54f08bb 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -145,6 +145,22 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
cmSystemTools::ConvertToUnixSlashes(value);
}
+ } else if (key == "VS_16_DIR") {
+ // If generating for the VS 16 IDE, use the same instance.
+ cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
+ if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 16 ")) {
+ cmGlobalVisualStudioVersionedGenerator* vs16gen =
+ static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
+ if (vs16gen->GetVSInstance(value)) {
+ return true;
+ }
+ }
+
+ // Otherwise, find a VS 16 instance ourselves.
+ cmVSSetupAPIHelper vsSetupAPIHelper(16);
+ if (vsSetupAPIHelper.GetVSInstanceInfo(value)) {
+ cmSystemTools::ConvertToUnixSlashes(value);
+ }
#endif
} else {
std::string e = "does not recognize <key> " + key;