summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-25 14:02:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-05-25 14:03:03 (GMT)
commitbf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06 (patch)
tree8f1124bf7f5904c1b3c83eb08905b417aa0a5809 /Source/cmMakefile.cxx
parent0c16774fecb8a9ef989f6c0a6705c080ee55d720 (diff)
parentd96eb5528276a19d79116d842389f3ea165ef21b (diff)
downloadCMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.zip
CMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.tar.gz
CMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.tar.bz2
Merge topic 'set-cache-keep-normal-variable'
d96eb55282 set(CACHE): do not remove normal variable Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !6146
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 675ff1d..ffe94ba 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)