|
|
@@ -1059,11 +1059,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;
|
|
|
}
|
|
|
}
|
|
|
@@ -1406,7 +1406,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 =
|
|
|
@@ -1456,9 +1456,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
|
|
|
@@ -1497,17 +1497,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 =
|
|
|
@@ -2702,59 +2702,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;
|
|
|
}
|
|
|
|
|
|
@@ -2838,7 +2837,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;
|
|
|
@@ -2847,7 +2846,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);
|
|
|
@@ -2857,14 +2856,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)
|