diff options
Diffstat (limited to 'Source/cmStateSnapshot.cxx')
-rw-r--r-- | Source/cmStateSnapshot.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 63bec71..121923d 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -222,14 +222,14 @@ bool cmStateSnapshot::IsInitialized(std::string const& name) const } void cmStateSnapshot::SetDefinition(std::string const& name, - std::string const& value) + cm::string_view value) { - this->Position->Vars->Set(name, value.c_str()); + this->Position->Vars->Set(name, value); } void cmStateSnapshot::RemoveDefinition(std::string const& name) { - this->Position->Vars->Set(name, nullptr); + this->Position->Vars->Unset(name); } std::vector<std::string> cmStateSnapshot::UnusedKeys() const @@ -264,7 +264,11 @@ bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef) cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root); // Now update the definition in the parent scope. - this->Position->Parent->Set(var, varDef); + if (varDef) { + this->Position->Parent->Set(var, varDef); + } else { + this->Position->Parent->Unset(var); + } return true; } @@ -324,7 +328,7 @@ void cmStateSnapshot::SetDefaultDefinitions() #if defined(__CYGWIN__) std::string legacy; if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) && - cmSystemTools::IsOn(legacy.c_str())) { + cmIsOn(legacy.c_str())) { this->SetDefinition("WIN32", "1"); this->SetDefinition("CMAKE_HOST_WIN32", "1"); } |