summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-03-17 16:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-03-17 16:09:20 (GMT)
commitbd891335432a5797a0415ebf35a6f22adba96684 (patch)
tree9d142b17e1750641d311d9f7fe2f11a4b7a52913 /Source/cmake.cxx
parentbee0100396d4b0dad7204125606e6baf26b79e38 (diff)
downloadCMake-bd891335432a5797a0415ebf35a6f22adba96684.zip
CMake-bd891335432a5797a0415ebf35a6f22adba96684.tar.gz
CMake-bd891335432a5797a0415ebf35a6f22adba96684.tar.bz2
cmState::GetCacheEntryValue: return cmProp
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx55
1 files changed, 27 insertions, 28 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 29ed61d..6082ed0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1058,11 +1058,11 @@ void cmake::SetDirectoriesFromFile(const std::string& arg)
// If there is a CMakeCache.txt file, use its settings.
if (!cachePath.empty()) {
if (this->LoadCache(cachePath)) {
- const char* existingValue =
+ cmProp existingValue =
this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
if (existingValue) {
this->SetHomeOutputDirectory(cachePath);
- this->SetHomeDirectory(existingValue);
+ this->SetHomeDirectory(*existingValue);
return;
}
}
@@ -1405,7 +1405,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
i++;
save.value = *i;
warning << *i << "\n";
- const char* existingValue = this->State->GetCacheEntryValue(save.key);
+ cmProp existingValue = this->State->GetCacheEntryValue(save.key);
if (existingValue) {
save.type = this->State->GetCacheEntryType(save.key);
if (const char* help =
@@ -1455,9 +1455,9 @@ int cmake::Configure()
if (this->DiagLevels.count("dev") == 1) {
bool setDeprecatedVariables = false;
- const char* cachedWarnDeprecated =
+ cmProp cachedWarnDeprecated =
this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
- const char* cachedErrorDeprecated =
+ cmProp cachedErrorDeprecated =
this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
// don't overwrite deprecated warning setting from a previous invocation
@@ -1496,17 +1496,17 @@ int cmake::Configure()
// Cache variables may have already been set by a previous invocation,
// so we cannot rely on command line options alone. Always ensure our
// messenger is in sync with the cache.
- const char* value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
- this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(value));
+ cmProp value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
+ this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(*value));
value = this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
- this->Messenger->SetDeprecatedWarningsAsErrors(cmIsOn(value));
+ this->Messenger->SetDeprecatedWarningsAsErrors(value && cmIsOn(*value));
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- this->Messenger->SetSuppressDevWarnings(cmIsOn(value));
+ this->Messenger->SetSuppressDevWarnings(value && cmIsOn(*value));
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
- this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(value));
+ this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(*value));
int ret = this->ActualConfigure();
const char* delCacheVars =
@@ -2701,59 +2701,58 @@ int cmake::Build(int jobs, const std::string& dir,
std::cerr << "Error: could not load cache\n";
return 1;
}
- const char* cachedGenerator =
- this->State->GetCacheEntryValue("CMAKE_GENERATOR");
+ cmProp cachedGenerator = this->State->GetCacheEntryValue("CMAKE_GENERATOR");
if (!cachedGenerator) {
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1;
}
- auto gen = this->CreateGlobalGenerator(cachedGenerator);
+ auto gen = this->CreateGlobalGenerator(*cachedGenerator);
if (!gen) {
- std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator
+ std::cerr << "Error: could create CMAKE_GENERATOR \"" << *cachedGenerator
<< "\"\n";
return 1;
}
this->SetGlobalGenerator(std::move(gen));
- const char* cachedGeneratorInstance =
+ cmProp cachedGeneratorInstance =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_INSTANCE");
if (cachedGeneratorInstance) {
cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
- if (!this->GlobalGenerator->SetGeneratorInstance(cachedGeneratorInstance,
+ if (!this->GlobalGenerator->SetGeneratorInstance(*cachedGeneratorInstance,
&mf)) {
return 1;
}
}
- const char* cachedGeneratorPlatform =
+ cmProp cachedGeneratorPlatform =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM");
if (cachedGeneratorPlatform) {
cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
- if (!this->GlobalGenerator->SetGeneratorPlatform(cachedGeneratorPlatform,
+ if (!this->GlobalGenerator->SetGeneratorPlatform(*cachedGeneratorPlatform,
&mf)) {
return 1;
}
}
- const char* cachedGeneratorToolset =
+ cmProp cachedGeneratorToolset =
this->State->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
if (cachedGeneratorToolset) {
cmMakefile mf(this->GetGlobalGenerator(), this->GetCurrentSnapshot());
- if (!this->GlobalGenerator->SetGeneratorToolset(cachedGeneratorToolset,
+ if (!this->GlobalGenerator->SetGeneratorToolset(*cachedGeneratorToolset,
true, &mf)) {
return 1;
}
}
std::string output;
std::string projName;
- const char* cachedProjectName =
+ cmProp cachedProjectName =
this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
if (!cachedProjectName) {
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
return 1;
}
- projName = cachedProjectName;
+ projName = *cachedProjectName;
- const char* cachedVerbose =
+ cmProp cachedVerbose =
this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
- if (cmIsOn(cachedVerbose)) {
+ if (cachedVerbose && cmIsOn(*cachedVerbose)) {
verbose = true;
}
@@ -2837,7 +2836,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
std::cerr << "Error: could not load cache\n";
return false;
}
- const char* genName = this->State->GetCacheEntryValue("CMAKE_GENERATOR");
+ cmProp genName = this->State->GetCacheEntryValue("CMAKE_GENERATOR");
if (!genName) {
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return false;
@@ -2846,7 +2845,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string fullName =
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
- genName, extraGenName ? *extraGenName : "");
+ *genName, extraGenName ? *extraGenName : "");
std::unique_ptr<cmGlobalGenerator> gen =
this->CreateGlobalGenerator(fullName);
@@ -2856,14 +2855,14 @@ bool cmake::Open(const std::string& dir, bool dryRun)
return false;
}
- const char* cachedProjectName =
+ cmProp cachedProjectName =
this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
if (!cachedProjectName) {
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
return false;
}
- return gen->Open(dir, cachedProjectName, dryRun);
+ return gen->Open(dir, *cachedProjectName, dryRun);
}
void cmake::WatchUnusedCli(const std::string& var)