ENH: Refactor find_package version file scoping

This converts the variable and policy scope protection find_package()
uses when loading version files to use automatic variables.
This commit is contained in:
Brad King 2009-01-22 10:56:58 -05:00
parent a01eb6b27b
commit c980021814
1 changed files with 4 additions and 6 deletions

View File

@ -1277,8 +1277,10 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
{ {
// The version file will be loaded in an isolated scope. // The version file will be loaded in an isolated scope.
this->Makefile->PushScope(); cmMakefile::ScopePushPop varScope(this->Makefile);
this->Makefile->PushPolicy(); cmMakefile::PolicyPushPop polScope(this->Makefile);
static_cast<void>(varScope);
static_cast<void>(polScope);
// Clear the output variables. // Clear the output variables.
this->Makefile->RemoveDefinition("PACKAGE_VERSION"); this->Makefile->RemoveDefinition("PACKAGE_VERSION");
@ -1344,10 +1346,6 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
} }
} }
// Restore the original scope.
this->Makefile->PopPolicy();
this->Makefile->PopScope();
// Succeed if the version is suitable. // Succeed if the version is suitable.
return suitable; return suitable;
} }