diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-03 08:09:10 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-03 08:09:10 (GMT) |
commit | 953d1b00af3059b24c4dadf8c4717cb0d2260e36 (patch) | |
tree | 9f7906699d3beba9d1885d082efc8da4573c4a6d | |
parent | 2c10494ab3194e792ad69825cbb55d6644270dd0 (diff) | |
download | CMake-953d1b00af3059b24c4dadf8c4717cb0d2260e36.zip CMake-953d1b00af3059b24c4dadf8c4717cb0d2260e36.tar.gz CMake-953d1b00af3059b24c4dadf8c4717cb0d2260e36.tar.bz2 |
cmPolicies: Make private method file-static.
-rw-r--r-- | Source/cmPolicies.cxx | 62 | ||||
-rw-r--r-- | Source/cmPolicies.h | 4 |
2 files changed, 31 insertions, 35 deletions
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 4b6ea5c..3f9c6f0 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -409,6 +409,36 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, } //---------------------------------------------------------------------------- +static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, + cmPolicies::PolicyStatus* defaultSetting) +{ + std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; + std::string defaultValue = mf->GetSafeDefinition(defaultVar); + if(defaultValue == "NEW") + { + *defaultSetting = cmPolicies::NEW; + } + else if(defaultValue == "OLD") + { + *defaultSetting = cmPolicies::OLD; + } + else if(defaultValue == "") + { + *defaultSetting = cmPolicies::WARN; + } + else + { + std::ostringstream e; + e << defaultVar << " has value \"" << defaultValue + << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + + return true; +} + +//---------------------------------------------------------------------------- bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, const char *version) { @@ -482,7 +512,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, else { cmPolicies::PolicyStatus status = cmPolicies::WARN; - if(!this->GetPolicyDefault(mf, i->second->IDString, &status) || + if(!GetPolicyDefault(mf, i->second->IDString, &status) || !mf->SetPolicy(i->second->ID, status)) { return false; @@ -510,36 +540,6 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, return true; } -//---------------------------------------------------------------------------- -bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, - cmPolicies::PolicyStatus* defaultSetting) -{ - std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; - std::string defaultValue = mf->GetSafeDefinition(defaultVar); - if(defaultValue == "NEW") - { - *defaultSetting = cmPolicies::NEW; - } - else if(defaultValue == "OLD") - { - *defaultSetting = cmPolicies::OLD; - } - else if(defaultValue == "") - { - *defaultSetting = cmPolicies::WARN; - } - else - { - std::ostringstream e; - e << defaultVar << " has value \"" << defaultValue - << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - return false; - } - - return true; -} - bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { if (!id || strlen(id) < 1) diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ba8a120..9de0298 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -164,10 +164,6 @@ public: void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient, unsigned int majorVer, unsigned int minorVer, unsigned int patchVer, cmMakefile* mf); - - bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, - cmPolicies::PolicyStatus* defaultStatus); - }; #endif |