From 3a462fa6739563cb059299d6956b41f6a828612d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 24 Jan 2008 07:37:15 -0500 Subject: [PATCH] ENH: Apply new implicit link directory find_library policy when loading a cache from an earlier CMake. --- Source/cmFindLibraryCommand.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 1f9a9f478..34f476e56 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -86,6 +86,26 @@ bool cmFindLibraryCommand this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } + + // If the existing value was loaded from a cache written by CMake + // 2.4 or below then force the implicit link directory fix on the + // value. + if(this->Makefile->NeedCacheCompatibility(2, 4)) + { + if(const char* v = + this->Makefile->GetDefinition(this->VariableName.c_str())) + { + std::string nv = this->FixForImplicitLocations(v); + if(nv != v) + { + this->Makefile + ->AddCacheDefinition(this->VariableName.c_str(), + nv.c_str(), + this->VariableDocumentation.c_str(), + cmCacheManager::FILEPATH); + } + } + } return true; }