mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 20:00:38 -06:00
cmState::GetCacheEntryValue: return cmProp
This commit is contained in:
@@ -48,25 +48,25 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||
this->IsNewLabel = cm::make_unique<cmCursesLabelWidget>(1, 1, 1, 1, " ");
|
||||
}
|
||||
|
||||
const char* value = state->GetCacheEntryValue(key);
|
||||
cmProp value = state->GetCacheEntryValue(key);
|
||||
assert(value);
|
||||
switch (state->GetCacheEntryType(key)) {
|
||||
case cmStateEnums::BOOL: {
|
||||
auto bw = cm::make_unique<cmCursesBoolWidget>(this->EntryWidth, 1, 1, 1);
|
||||
bw->SetValueAsBool(cmIsOn(value));
|
||||
bw->SetValueAsBool(cmIsOn(*value));
|
||||
this->Entry = std::move(bw);
|
||||
break;
|
||||
}
|
||||
case cmStateEnums::PATH: {
|
||||
auto pw = cm::make_unique<cmCursesPathWidget>(this->EntryWidth, 1, 1, 1);
|
||||
pw->SetString(value);
|
||||
pw->SetString(*value);
|
||||
this->Entry = std::move(pw);
|
||||
break;
|
||||
}
|
||||
case cmStateEnums::FILEPATH: {
|
||||
auto fpw =
|
||||
cm::make_unique<cmCursesFilePathWidget>(this->EntryWidth, 1, 1, 1);
|
||||
fpw->SetString(value);
|
||||
fpw->SetString(*value);
|
||||
this->Entry = std::move(fpw);
|
||||
break;
|
||||
}
|
||||
@@ -78,12 +78,12 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
|
||||
for (std::string const& opt : cmExpandedList(stringsProp)) {
|
||||
ow->AddOption(opt);
|
||||
}
|
||||
ow->SetOption(value);
|
||||
ow->SetOption(*value);
|
||||
this->Entry = std::move(ow);
|
||||
} else {
|
||||
auto sw =
|
||||
cm::make_unique<cmCursesStringWidget>(this->EntryWidth, 1, 1, 1);
|
||||
sw->SetString(value);
|
||||
sw->SetString(*value);
|
||||
this->Entry = std::move(sw);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -161,7 +161,7 @@ void cmCursesMainForm::RePost()
|
||||
// If normal mode, count only non-advanced entries
|
||||
this->NumberOfVisibleEntries = 0;
|
||||
for (cmCursesCacheEntryComposite& entry : this->Entries) {
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue());
|
||||
bool advanced =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
|
||||
@@ -182,7 +182,7 @@ void cmCursesMainForm::RePost()
|
||||
|
||||
// Assign fields
|
||||
for (cmCursesCacheEntryComposite& entry : this->Entries) {
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue());
|
||||
bool advanced =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
|
||||
@@ -241,7 +241,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||
// If normal, display only non-advanced entries
|
||||
this->NumberOfVisibleEntries = 0;
|
||||
for (cmCursesCacheEntryComposite& entry : this->Entries) {
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue());
|
||||
bool advanced =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
|
||||
@@ -259,7 +259,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
|
||||
bool isNewPage;
|
||||
int i = 0;
|
||||
for (cmCursesCacheEntryComposite& entry : this->Entries) {
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(entry.GetValue());
|
||||
bool advanced =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryPropertyAsBool(
|
||||
@@ -405,7 +405,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional<std::string> message)
|
||||
// Get the help string of the current entry
|
||||
// and add it to the help string
|
||||
auto cmakeState = this->CMakeInstance->GetState();
|
||||
const char* existingValue = cmakeState->GetCacheEntryValue(labelValue);
|
||||
cmProp existingValue = cmakeState->GetCacheEntryValue(labelValue);
|
||||
if (existingValue) {
|
||||
auto help = cmakeState->GetCacheEntryProperty(labelValue, "HELPSTRING");
|
||||
if (help) {
|
||||
@@ -616,10 +616,10 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||
{
|
||||
for (cmCursesCacheEntryComposite& entry : this->Entries) {
|
||||
const std::string& cacheKey = entry.Key;
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey);
|
||||
if (existingValue) {
|
||||
std::string oldValue = existingValue;
|
||||
std::string oldValue = *existingValue;
|
||||
std::string newValue = entry.Entry->GetValue();
|
||||
std::string fixedOldValue;
|
||||
std::string fixedNewValue;
|
||||
@@ -804,7 +804,7 @@ void cmCursesMainForm::HandleInput()
|
||||
const char* curField = lbl->GetValue();
|
||||
const char* helpString = nullptr;
|
||||
|
||||
const char* existingValue =
|
||||
cmProp existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
|
||||
if (existingValue) {
|
||||
helpString = this->CMakeInstance->GetState()->GetCacheEntryProperty(
|
||||
|
||||
@@ -100,29 +100,28 @@ void QCMake::setBinaryDirectory(const QString& _dir)
|
||||
|
||||
QCMakePropertyList props = this->properties();
|
||||
emit this->propertiesChanged(props);
|
||||
const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||
cmProp homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||
if (homeDir) {
|
||||
setSourceDirectory(QString::fromLocal8Bit(homeDir));
|
||||
setSourceDirectory(QString::fromLocal8Bit(homeDir->c_str()));
|
||||
}
|
||||
const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
|
||||
cmProp gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
|
||||
if (gen) {
|
||||
const std::string* extraGen =
|
||||
state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||
std::string curGen =
|
||||
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
|
||||
gen, extraGen ? *extraGen : "");
|
||||
*gen, extraGen ? *extraGen : "");
|
||||
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
|
||||
}
|
||||
|
||||
const char* platform =
|
||||
state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM");
|
||||
cmProp platform = state->GetCacheEntryValue("CMAKE_GENERATOR_PLATFORM");
|
||||
if (platform) {
|
||||
this->setPlatform(QString::fromLocal8Bit(platform));
|
||||
this->setPlatform(QString::fromLocal8Bit(platform->c_str()));
|
||||
}
|
||||
|
||||
const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
|
||||
cmProp toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
|
||||
if (toolset) {
|
||||
this->setToolset(QString::fromLocal8Bit(toolset));
|
||||
this->setToolset(QString::fromLocal8Bit(toolset->c_str()));
|
||||
}
|
||||
|
||||
checkOpenPossible();
|
||||
@@ -303,17 +302,17 @@ QCMakePropertyList QCMake::properties() const
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* cachedValue = state->GetCacheEntryValue(key);
|
||||
cmProp cachedValue = state->GetCacheEntryValue(key);
|
||||
|
||||
QCMakeProperty prop;
|
||||
prop.Key = QString::fromLocal8Bit(key.c_str());
|
||||
prop.Help =
|
||||
QString::fromLocal8Bit(state->GetCacheEntryProperty(key, "HELPSTRING"));
|
||||
prop.Value = QString::fromLocal8Bit(cachedValue);
|
||||
prop.Value = QString::fromLocal8Bit(cachedValue->c_str());
|
||||
prop.Advanced = state->GetCacheEntryPropertyAsBool(key, "ADVANCED");
|
||||
if (t == cmStateEnums::BOOL) {
|
||||
prop.Type = QCMakeProperty::BOOL;
|
||||
prop.Value = cmIsOn(cachedValue);
|
||||
prop.Value = cmIsOn(*cachedValue);
|
||||
} else if (t == cmStateEnums::PATH) {
|
||||
prop.Type = QCMakeProperty::PATH;
|
||||
} else if (t == cmStateEnums::FILEPATH) {
|
||||
|
||||
@@ -67,7 +67,7 @@ Json::Value Cache::DumpEntry(std::string const& name)
|
||||
entry["name"] = name;
|
||||
entry["type"] =
|
||||
cmState::CacheEntryTypeToString(this->State->GetCacheEntryType(name));
|
||||
entry["value"] = this->State->GetCacheEntryValue(name);
|
||||
entry["value"] = this->State->GetSafeCacheEntryValue(name);
|
||||
|
||||
Json::Value properties = this->DumpEntryProperties(name);
|
||||
if (!properties.empty()) {
|
||||
|
||||
@@ -296,7 +296,7 @@ bool cmFindBase::CheckForVariableInCache()
|
||||
if (const char* cacheValue =
|
||||
this->Makefile->GetDefinition(this->VariableName)) {
|
||||
cmState* state = this->Makefile->GetState();
|
||||
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
||||
cmProp cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
||||
bool found = !cmIsNOTFOUND(cacheValue);
|
||||
bool cached = cacheEntry != nullptr;
|
||||
if (found) {
|
||||
|
||||
@@ -3042,7 +3042,9 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
|
||||
}
|
||||
break;
|
||||
case CACHE:
|
||||
value = state->GetCacheEntryValue(lookup);
|
||||
if (cmProp value2 = state->GetCacheEntryValue(lookup)) {
|
||||
value = value2->c_str();
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Get the string we're meant to append to.
|
||||
|
||||
@@ -52,7 +52,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
|
||||
// See if a cache variable with this name already exists
|
||||
// If so just make sure the doc state is correct
|
||||
cmState* state = status.GetMakefile().GetState();
|
||||
const char* existingValue = state->GetCacheEntryValue(args[0]);
|
||||
cmProp existingValue = state->GetCacheEntryValue(args[0]);
|
||||
if (existingValue &&
|
||||
(state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED)) {
|
||||
state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
|
||||
@@ -60,7 +60,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
// Nothing in the cache so add it
|
||||
std::string initialValue = existingValue ? existingValue : "Off";
|
||||
std::string initialValue = existingValue ? *existingValue : "Off";
|
||||
if (args.size() == 3) {
|
||||
initialValue = args[2];
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ static bool getOrTestHomeDirectory(cmState* state, std::string& value,
|
||||
std::string* errorMessage)
|
||||
{
|
||||
const std::string cachedValue =
|
||||
std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"));
|
||||
*state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
|
||||
if (value.empty()) {
|
||||
value = cachedValue;
|
||||
return true;
|
||||
@@ -205,9 +205,7 @@ static bool getOrTestValue(cmState* state, const std::string& key,
|
||||
const std::string& keyDescription,
|
||||
std::string* errorMessage)
|
||||
{
|
||||
const char* entry = state->GetCacheEntryValue(key);
|
||||
const std::string cachedValue =
|
||||
entry == nullptr ? std::string() : std::string(entry);
|
||||
const std::string cachedValue = state->GetSafeCacheEntryValue(key);
|
||||
if (value.empty()) {
|
||||
value = cachedValue;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ bool cmSetCommand(std::vector<std::string> const& args,
|
||||
|
||||
// see if this is already in the cache
|
||||
cmState* state = status.GetMakefile().GetState();
|
||||
const char* existingValue = state->GetCacheEntryValue(variable);
|
||||
cmProp existingValue = state->GetCacheEntryValue(variable);
|
||||
if (existingValue &&
|
||||
(state->GetCacheEntryType(variable) != cmStateEnums::UNINITIALIZED)) {
|
||||
// if the set is trying to CACHE the value but the value
|
||||
|
||||
@@ -438,7 +438,7 @@ bool HandleCacheMode(cmExecutionStatus& status,
|
||||
for (std::string const& name : names) {
|
||||
// Get the source file.
|
||||
cmake* cm = status.GetMakefile().GetCMakeInstance();
|
||||
const char* existingValue = cm->GetState()->GetCacheEntryValue(name);
|
||||
cmProp existingValue = cm->GetState()->GetCacheEntryValue(name);
|
||||
if (existingValue) {
|
||||
if (!HandleCacheEntry(name, status.GetMakefile(), propertyName,
|
||||
propertyValue, appendAsString, appendMode,
|
||||
|
||||
@@ -132,23 +132,22 @@ std::vector<std::string> cmState::GetCacheEntryKeys() const
|
||||
return definitions;
|
||||
}
|
||||
|
||||
const char* cmState::GetCacheEntryValue(std::string const& key) const
|
||||
cmProp cmState::GetCacheEntryValue(std::string const& key) const
|
||||
{
|
||||
cmCacheManager::CacheEntry* e = this->CacheManager->GetCacheEntry(key);
|
||||
if (!e) {
|
||||
return nullptr;
|
||||
}
|
||||
return e->Value.c_str();
|
||||
return &e->Value;
|
||||
}
|
||||
|
||||
std::string cmState::GetSafeCacheEntryValue(std::string const& key) const
|
||||
{
|
||||
std::string retval;
|
||||
auto val = this->GetCacheEntryValue(key);
|
||||
cmProp val = this->GetCacheEntryValue(key);
|
||||
if (val) {
|
||||
retval = val;
|
||||
return *val;
|
||||
}
|
||||
return retval;
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const std::string* cmState::GetInitializedCacheValue(
|
||||
|
||||
@@ -30,6 +30,8 @@ class cmStateSnapshot;
|
||||
class cmMessenger;
|
||||
class cmExecutionStatus;
|
||||
|
||||
using cmProp = const std::string*;
|
||||
|
||||
class cmState
|
||||
{
|
||||
friend class cmStateSnapshot;
|
||||
@@ -87,7 +89,7 @@ public:
|
||||
bool DeleteCache(const std::string& path);
|
||||
|
||||
std::vector<std::string> GetCacheEntryKeys() const;
|
||||
const char* GetCacheEntryValue(std::string const& key) const;
|
||||
cmProp GetCacheEntryValue(std::string const& key) const;
|
||||
std::string GetSafeCacheEntryValue(std::string const& key) const;
|
||||
const std::string* GetInitializedCacheValue(std::string const& key) const;
|
||||
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const;
|
||||
|
||||
@@ -242,8 +242,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||
comment.c_str(), cmStateEnums::STRING);
|
||||
|
||||
cmState* state = this->Makefile->GetState();
|
||||
const char* existingValue =
|
||||
state->GetCacheEntryValue(this->RunResultVariable);
|
||||
cmProp existingValue = state->GetCacheEntryValue(this->RunResultVariable);
|
||||
if (existingValue) {
|
||||
state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
|
||||
}
|
||||
@@ -265,7 +264,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||
internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(),
|
||||
cmStateEnums::STRING);
|
||||
cmState* state = this->Makefile->GetState();
|
||||
const char* existing = state->GetCacheEntryValue(internalRunOutputName);
|
||||
cmProp existing = state->GetCacheEntryValue(internalRunOutputName);
|
||||
if (existing) {
|
||||
state->SetCacheEntryProperty(internalRunOutputName, "ADVANCED", "1");
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -301,7 +301,7 @@ int do_cmake(int ac, char const* const* av)
|
||||
<< std::endl;
|
||||
}
|
||||
std::cout << k << ":" << cmState::CacheEntryTypeToString(t) << "="
|
||||
<< cm.GetState()->GetCacheEntryValue(k) << std::endl;
|
||||
<< cm.GetState()->GetSafeCacheEntryValue(k) << std::endl;
|
||||
if (list_help) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user