summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-01-22 15:56:58 (GMT)
committerBrad King <brad.king@kitware.com>2009-01-22 15:56:58 (GMT)
commitc980021814f9717b3d9381029a323c5154a1a503 (patch)
tree51c7d65549f895edab2d0347fac9fdf2705383f3 /Source/cmFindPackageCommand.cxx
parenta01eb6b27be0e9a32378c56140d231ceda612368 (diff)
downloadCMake-c980021814f9717b3d9381029a323c5154a1a503.zip
CMake-c980021814f9717b3d9381029a323c5154a1a503.tar.gz
CMake-c980021814f9717b3d9381029a323c5154a1a503.tar.bz2
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.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index a00bf4b..a57a4f1 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1277,8 +1277,10 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file)
{
// The version file will be loaded in an isolated scope.
- this->Makefile->PushScope();
- this->Makefile->PushPolicy();
+ cmMakefile::ScopePushPop varScope(this->Makefile);
+ cmMakefile::PolicyPushPop polScope(this->Makefile);
+ static_cast<void>(varScope);
+ static_cast<void>(polScope);
// Clear the output variables.
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.
return suitable;
}