summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
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)