summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.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/cmFindPackageCommand.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/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 3719fe1..fba736e 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1138,6 +1138,11 @@ bool cmFindPackageCommand::FindConfig()
// We force the value since we do not get here if it was already set.
this->Makefile->AddCacheDefinition(this->Variable, init, help.c_str(),
cmStateEnums::PATH, true);
+ if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
+ cmPolicies::NEW &&
+ this->Makefile->IsNormalDefinitionSet(this->Variable)) {
+ this->Makefile->AddDefinition(this->Variable, init);
+ }
return found;
}