diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-05-20 13:14:30 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2021-05-20 15:50:13 (GMT) |
commit | d96eb5528276a19d79116d842389f3ea165ef21b (patch) | |
tree | d9b7bebf4ced2582efba39187c41476171508384 /Source/cmMakefile.cxx | |
parent | 34f9a551ce5631baef159076c697dd8f86daa8b8 (diff) | |
download | CMake-d96eb5528276a19d79116d842389f3ea165ef21b.zip CMake-d96eb5528276a19d79116d842389f3ea165ef21b.tar.gz CMake-d96eb5528276a19d79116d842389f3ea165ef21b.tar.bz2 |
set(CACHE): do not remove normal variable
Fixes: #22038
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4ffd47b..d7987c2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1962,10 +1962,10 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, } } this->GetCMakeInstance()->AddCacheEntry(name, value, doc, type); - // if there was a definition then remove it - // The method cmFindBase::NormalizeFindResult also apply same workflow. - // See #22038 for problems raised by this behavior. - this->StateSnapshot.RemoveDefinition(name); + if (this->GetPolicyStatus(cmPolicies::CMP0126) != cmPolicies::NEW) { + // if there was a definition then remove it + this->StateSnapshot.RemoveDefinition(name); + } } void cmMakefile::MarkVariableAsUsed(const std::string& var) |