summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-05-20 13:14:30 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-05-20 15:50:13 (GMT)
commitd96eb5528276a19d79116d842389f3ea165ef21b (patch)
treed9b7bebf4ced2582efba39187c41476171508384 /Source/cmMakefile.cxx
parent34f9a551ce5631baef159076c697dd8f86daa8b8 (diff)
downloadCMake-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.cxx8
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)