summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmPolicies.cxx9
-rw-r--r--Source/cmPolicies.h3
4 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9e53579d84..23883f7175 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4149,9 +4149,9 @@ void cmMakefile::PopSnapshot(bool reportError)
assert(this->StateSnapshot.IsValid());
}
-bool cmMakefile::SetPolicyVersion(const char* version)
+bool cmMakefile::SetPolicyVersion(std::string const& version_min)
{
- return cmPolicies::ApplyPolicyVersion(this, version);
+ return cmPolicies::ApplyPolicyVersion(this, version_min);
}
bool cmMakefile::HasCMP0054AlreadyBeenReported(
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 95ba53a12c..e90cf2f190 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -285,7 +285,7 @@ public:
bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
bool SetPolicy(const char* id, cmPolicies::PolicyStatus status);
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const;
- bool SetPolicyVersion(const char* version);
+ bool SetPolicyVersion(std::string const& version_min);
void RecordPolicies(cmPolicies::PolicyMap& pm);
//@}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index e7d1b72183..7e3bd78dec 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -153,12 +153,13 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
return true;
}
-bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version)
+bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf,
+ std::string const& version_min)
{
std::string ver = "2.4.0";
- if (version && strlen(version) > 0) {
- ver = version;
+ if (!version_min.empty()) {
+ ver = version_min;
}
unsigned int majorVer = 2;
@@ -200,7 +201,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version)
tweakVer > cmVersion::GetTweakVersion())) {
std::ostringstream e;
e << "An attempt was made to set the policy version of CMake to \""
- << version << "\" which is greater than this version of CMake. "
+ << version_min << "\" which is greater than this version of CMake. "
<< "This is not allowed because the greater version may have new "
<< "policies not known to this CMake. "
<< "You may need a newer CMake version to build this project.";
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a784f98b0e..2198184e44 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -288,7 +288,8 @@ public:
static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
///! Set a policy level for this listfile
- static bool ApplyPolicyVersion(cmMakefile* mf, const char* version);
+ static bool ApplyPolicyVersion(cmMakefile* mf,
+ std::string const& version_min);
///! return a warning string for a given policy
static std::string GetPolicyWarning(cmPolicies::PolicyID id);