diff options
author | Brad King <brad.king@kitware.com> | 2017-01-12 15:20:48 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-01-12 15:20:48 (GMT) |
commit | 88a816c6b9b4f5cb11b40410935d47fa61b39858 (patch) | |
tree | 0acb9bb9accd07ea94cf9d5be3d45d6a0f82fed1 /Source/cmGlobalVisualStudio15Generator.cxx | |
parent | e15106b2f1825fb42bb82a47b1ee5e9299212fa6 (diff) | |
parent | 3a97a3713a498c9a89a1733131196f7fcd03552c (diff) | |
download | CMake-88a816c6b9b4f5cb11b40410935d47fa61b39858.zip CMake-88a816c6b9b4f5cb11b40410935d47fa61b39858.tar.gz CMake-88a816c6b9b4f5cb11b40410935d47fa61b39858.tar.bz2 |
Merge topic 'vs15-detect-from-installer'
3a97a371 VS: Port Visual Studio Setup third-party header to older VS versions
c93e85d8 VS: Use Visual Studio Installer to locate VS 2017
18c8278b VS: Add helper class to interact with Visual Studio Installer
d47bda00 VS: Fix VS 2017 Windows Store toolset selection
efdfc26e VS: Drop check for VS 15 Express Edition
ad5b702c VS: Port Visual Studio Setup third-party header to MinGW
def7395f VS: Add Visual Studio Setup third-party header
Diffstat (limited to 'Source/cmGlobalVisualStudio15Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio15Generator.cxx | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 20d30bc..d11ee7c 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -8,6 +8,7 @@ #include "cmMakefile.h" #include "cmVS141CLFlagTable.h" #include "cmVS141CSharpFlagTable.h" +#include "cmVSSetupHelper.h" static const char vs15generatorName[] = "Visual Studio 15 2017"; @@ -80,11 +81,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( cmake* cm, const std::string& name, const std::string& platformName) : cmGlobalVisualStudio14Generator(cm, name, platformName) { - std::string vc15Express; - this->ExpressEdition = cmSystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;" - "ProductDir", - vc15Express, cmSystemTools::KeyWOW64_32); + this->ExpressEdition = false; this->DefaultPlatformToolset = "v141"; this->DefaultClFlagTable = cmVS141CLFlagTable; this->DefaultCSharpFlagTable = cmVS141CSharpFlagTable; @@ -118,7 +115,7 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { if (this->IsWindowsStoreToolsetInstalled() && this->IsWindowsDesktopToolsetInstalled()) { - toolset = "v140"; // VS 15 uses v140 toolset + toolset = "v141"; // VS 15 uses v141 toolset return true; } else { return false; @@ -130,21 +127,44 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const { - const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" - "VisualStudio\\15.0\\VC\\Runtimes"; - - std::vector<std::string> vc15; - return cmSystemTools::GetRegistrySubKeys(desktop10Key, vc15, - cmSystemTools::KeyWOW64_32); + return vsSetupAPIHelper.IsVS2017Installed(); } bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const { - const char universal10Key[] = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" - "VisualStudio\\15.0\\Setup\\Build Tools for Windows 10;SrcPath"; + return vsSetupAPIHelper.IsWin10SDKInstalled(); +} + +std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand() +{ + std::string msbuild; + + // Ask Visual Studio Installer tool. + std::string vs; + if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + } + + msbuild = "MSBuild.exe"; + return msbuild; +} + +std::string cmGlobalVisualStudio15Generator::FindDevEnvCommand() +{ + std::string devenv; + + // Ask Visual Studio Installer tool. + std::string vs; + if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + devenv = vs + "/Common7/IDE/devenv.com"; + if (cmSystemTools::FileExists(devenv)) { + return devenv; + } + } - std::string win10SDK; - return cmSystemTools::ReadRegistryValue(universal10Key, win10SDK, - cmSystemTools::KeyWOW64_32); + devenv = "devenv.com"; + return devenv; } |