summaryrefslogtreecommitdiffstats
path: root/Source/cmVSSetupHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-12 16:29:06 (GMT)
committerBrad King <brad.king@kitware.com>2017-01-12 16:32:44 (GMT)
commit0362c60fe5f4e7e4011f14dc2519ffb1bc6c8ce8 (patch)
tree0f0534aaacd14547fd3a42800ffaac02c04487ac /Source/cmVSSetupHelper.cxx
parent577f721fb70bbf6c29c40d5f10d4319370ccb1f8 (diff)
downloadCMake-0362c60fe5f4e7e4011f14dc2519ffb1bc6c8ce8.zip
CMake-0362c60fe5f4e7e4011f14dc2519ffb1bc6c8ce8.tar.gz
CMake-0362c60fe5f4e7e4011f14dc2519ffb1bc6c8ce8.tar.bz2
cmVSSetupHelper: Simplify use of EnumerateAndChooseVSInstance
This method short-circuits when an instance has already been chosen, so avoid duplicating this check at call sites.
Diffstat (limited to 'Source/cmVSSetupHelper.cxx')
-rw-r--r--Source/cmVSSetupHelper.cxx45
1 files changed, 7 insertions, 38 deletions
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 2091b5c..c2ff664 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -73,44 +73,19 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper()
bool cmVSSetupAPIHelper::IsVS2017Installed()
{
- bool ret = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- ret = EnumerateAndChooseVSInstance();
- } else {
- ret = true;
- }
-
- return ret;
+ return this->EnumerateAndChooseVSInstance();
}
bool cmVSSetupAPIHelper::IsWin10SDKInstalled()
{
- bool isWin10SDKInstalled = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- if (EnumerateAndChooseVSInstance() &&
- chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
- isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
- }
- } else {
- isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled;
- }
-
- return isWin10SDKInstalled;
+ return (this->EnumerateAndChooseVSInstance() &&
+ chosenInstanceInfo.IsWin10SDKInstalled);
}
bool cmVSSetupAPIHelper::IsWin81SDKInstalled()
{
- bool isWin81SDKInstalled = false;
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- if (EnumerateAndChooseVSInstance() &&
- chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
- isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
- }
- } else {
- isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled;
- }
-
- return isWin81SDKInstalled;
+ return (this->EnumerateAndChooseVSInstance() &&
+ chosenInstanceInfo.IsWin81SDKInstalled);
}
bool cmVSSetupAPIHelper::CheckInstalledComponent(
@@ -243,18 +218,12 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(
bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation)
{
vsInstallLocation = "";
- bool isInstalled = false;
-
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) {
- isInstalled = EnumerateAndChooseVSInstance();
- }
+ bool isInstalled = this->EnumerateAndChooseVSInstance();
- // Enumerate and choose best VS instance
- if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) {
+ if (isInstalled) {
std::string str(chosenInstanceInfo.VSInstallLocation.begin(),
chosenInstanceInfo.VSInstallLocation.end());
vsInstallLocation = str;
- isInstalled = true;
}
return isInstalled;