[Cmake-commits] CMake branch, next, updated. v3.2.2-2443-g2950a55
Stephen Kelly
steveire at gmail.com
Sun May 3 04:45:58 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 2950a5542fc22c205e3b7aafe4ad28a1961c2611 (commit)
via 0e53f739be3692a60e8a47d589d3979c50d7c904 (commit)
via eb861a41fdcfe9f518a949c44c982c4bb6d3b81e (commit)
via 8988d8ee8bf936074e6d94cac643dfd704e86fbd (commit)
via 2334325421903c977c1e8842223629c02269145f (commit)
via 275a0404be55bfdda06346b72d9d30348b5c15bd (commit)
via ab89036c52258f75637adf3f4650a5fbf38f8033 (commit)
via dec28e70dd37e89b6db1daa082ff9be601c3b36b (commit)
via 82a80e5d9e6e4004e6786b38bba550382dfd3f63 (commit)
via 68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9 (commit)
via 92b31f19c1aac58d4e0a33d37f9b3bc3918d7099 (commit)
via a140aa6907b22dd17dbfc66102bbb6a089e4cf9a (commit)
via 8de7d84c36b2519867dca9ca48d1c97512e9a07a (commit)
via b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a (commit)
via 9273eadea728a0b63fe6acbcc634f5e71083dfaa (commit)
via 8c58c7b825f1e1463f2246b8c273ddc9bd680603 (commit)
via 51662a178929cd6802008b282840077b1f87e61c (commit)
via 76e5bd042ced3dab01e5d2c88a2199f09ca806ae (commit)
via ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a (commit)
via 953d1b00af3059b24c4dadf8c4717cb0d2260e36 (commit)
via 2c10494ab3194e792ad69825cbb55d6644270dd0 (commit)
via 48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78 (commit)
via fd0aa7434b010c496e09d8013b192b7df453979a (commit)
via a3291fe8ecb95c891a34c1844557cbfa2bb89e2d (commit)
via a6fb6db49d9fc5558fd79296fbc233f90a3063e4 (commit)
from 656579f48975716f16aff00772be4d2ef96a9741 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2950a5542fc22c205e3b7aafe4ad28a1961c2611
commit 2950a5542fc22c205e3b7aafe4ad28a1961c2611
Merge: 656579f 0e53f73
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 04:45:55 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun May 3 04:45:55 2015 -0400
Merge topic 'refactor-cmPolicies' into next
0e53f739 cmPolicies: Implement PolicyMap in terms of bitset.
eb861a41 cmPolicies: Implement abstraction for PolicyMap.
8988d8ee Port to static cmPolicies API.
23343254 cmPolicies: Make all API static.
275a0404 cmPolicies: Remove unused DefinePolicy method.
ab89036c cmPolicies: Remove unused cmPolicy class.
dec28e70 cmPolicies: Loop over all policies using enum constants.
82a80e5d cmPolicies: Trivialize GetPolicyStatus method.
68bc1d79 cmPolicies: Use more-direct ID access.
92b31f19 cmPolicies: Implement in terms of public API.
a140aa69 cmPolicies: Make private method file-static.
8de7d84c cmPolicies: Implement short description access with XMacros.
b46cb9fe cmPolicies: Implement version check with XMacro.
9273eade cmPolicies: Implement id to version with XMacro.
8c58c7b8 cmPolicies: Implement id to string conversion with XMacro.
51662a17 cmPolicies: Introduce XMacro table for policy data.
...
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e53f739be3692a60e8a47d589d3979c50d7c904
commit 0e53f739be3692a60e8a47d589d3979c50d7c904
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:12:34 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:40:54 2015 +0200
cmPolicies: Implement PolicyMap in terms of bitset.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index f593149..73f6e0e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -331,21 +331,42 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
cmPolicies::PolicyStatus
cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
{
- return this->find(id)->second;
+ PolicyStatus status = cmPolicies::WARN;
+
+ if (this->OLD[id])
+ {
+ status = cmPolicies::OLD;
+ }
+ else if (this->NEW[id])
+ {
+ status = cmPolicies::NEW;
+ }
+ else if (this->REQUIRED_ALWAYS[id])
+ {
+ status = cmPolicies::REQUIRED_ALWAYS;
+ }
+ else if (this->REQUIRED_IF_USED[id])
+ {
+ status = cmPolicies::REQUIRED_IF_USED;
+ }
+ return status;
}
void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
cmPolicies::PolicyStatus status)
{
- (*this)[id] = status;
+ this->OLD[id] = (status == cmPolicies::OLD);
+ this->NEW[id] = (status == cmPolicies::NEW);
+ this->REQUIRED_ALWAYS[id] = (status == cmPolicies::REQUIRED_ALWAYS);
+ this->REQUIRED_IF_USED[id] = (status == cmPolicies::REQUIRED_IF_USED);
}
bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
{
- return this->find(id) != this->end();
+ return this->OLD[id] || this->NEW[id];
}
bool cmPolicies::PolicyMap::IsEmpty() const
{
- return this->empty();
+ return this->OLD.none() && this->NEW.none();
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 46b725a..6bc92fb 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -14,6 +14,8 @@
#include "cmCustomCommand.h"
+#include <bitset>
+
class cmMakefile;
class cmPolicy;
@@ -268,12 +270,18 @@ public:
static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
/** Represent a set of policy values. */
- struct PolicyMap : private std::map<PolicyID, PolicyStatus>
+ struct PolicyMap
{
PolicyStatus Get(PolicyID id) const;
void Set(PolicyID id, PolicyStatus status);
bool IsDefined(PolicyID id) const;
bool IsEmpty() const;
+
+ private:
+ std::bitset<cmPolicies::CMPCOUNT> OLD;
+ std::bitset<cmPolicies::CMPCOUNT> NEW;
+ std::bitset<cmPolicies::CMPCOUNT> REQUIRED_IF_USED;
+ std::bitset<cmPolicies::CMPCOUNT> REQUIRED_ALWAYS;
};
};
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb861a41fdcfe9f518a949c44c982c4bb6d3b81e
commit eb861a41fdcfe9f518a949c44c982c4bb6d3b81e
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:12:28 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:40:45 2015 +0200
cmPolicies: Implement abstraction for PolicyMap.
Hide the detail that it is a std::map.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 29d891c..3befbdd 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -569,7 +569,7 @@ cmMakefile::IncludeScope::~IncludeScope()
// one we pushed above. If the entry is empty, then the included
// script did not set any policies that might affect the includer so
// we do not need to enforce the policy.
- if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().empty())
+ if(this->CheckCMP0011 && this->Makefile->PolicyStack.back().IsEmpty())
{
this->CheckCMP0011 = false;
}
@@ -4772,10 +4772,9 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin();
psi != this->PolicyStack.rend(); ++psi)
{
- PolicyStackEntry::const_iterator pse = psi->find(id);
- if(pse != psi->end())
+ if(psi->IsDefined(id))
{
- return pse->second;
+ return psi->Get(id);
}
}
@@ -4840,7 +4839,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin();
previous_was_weak && psi != this->PolicyStack.rend(); ++psi)
{
- (*psi)[id] = status;
+ psi->Set(id, status);
previous_was_weak = psi->Weak;
}
@@ -4960,7 +4959,7 @@ void cmMakefile::RecordPolicies(cmPolicies::PolicyMap& pm)
for(PolicyID pid = cmPolicies::CMP0000;
pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1))
{
- pm[pid] = this->GetPolicyStatus(pid);
+ pm.Set(pid, this->GetPolicyStatus(pid));
}
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index b0dfa36..f593149 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -327,3 +327,25 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
<< "Run cmake --help-policy " << pid << " for more information.";
return e.str();
}
+
+cmPolicies::PolicyStatus
+cmPolicies::PolicyMap::Get(cmPolicies::PolicyID id) const
+{
+ return this->find(id)->second;
+}
+
+void cmPolicies::PolicyMap::Set(cmPolicies::PolicyID id,
+ cmPolicies::PolicyStatus status)
+{
+ (*this)[id] = status;
+}
+
+bool cmPolicies::PolicyMap::IsDefined(cmPolicies::PolicyID id) const
+{
+ return this->find(id) != this->end();
+}
+
+bool cmPolicies::PolicyMap::IsEmpty() const
+{
+ return this->empty();
+}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index fee7dd9..46b725a 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -268,7 +268,13 @@ public:
static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
/** Represent a set of policy values. */
- typedef std::map<PolicyID, PolicyStatus> PolicyMap;
+ struct PolicyMap : private std::map<PolicyID, PolicyStatus>
+ {
+ PolicyStatus Get(PolicyID id) const;
+ void Set(PolicyID id, PolicyStatus status);
+ bool IsDefined(PolicyID id) const;
+ bool IsEmpty() const;
+ };
};
#endif
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8988d8ee8bf936074e6d94cac643dfd704e86fbd
commit 8988d8ee8bf936074e6d94cac643dfd704e86fbd
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:12:10 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:40:37 2015 +0200
Port to static cmPolicies API.
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index ba9e663..fe516ea 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -380,8 +380,7 @@ bool cmAddCustomCommandCommand
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0050)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0050) << "\n";
break;
case cmPolicies::OLD:
issueMessage = false;
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index c246aee..42bd71c 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -194,8 +194,7 @@ bool cmAddCustomTargetCommand
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
issueMessage = true;
case cmPolicies::OLD:
break;
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 74dc8eb..d15fc1e 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -84,8 +84,7 @@ bool cmAddExecutableCommand
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
issueMessage = true;
case cmPolicies::OLD:
break;
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 74e1a93..a844cf1 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -222,8 +222,7 @@ bool cmAddLibraryCommand
case cmPolicies::WARN:
if(type != cmTarget::INTERFACE_LIBRARY)
{
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n";
issueMessage = true;
}
case cmPolicies::OLD:
diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx
index 34245b3..fc0c3f5 100644
--- a/Source/cmBreakCommand.cxx
+++ b/Source/cmBreakCommand.cxx
@@ -23,8 +23,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const &args,
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n";
break;
case cmPolicies::OLD:
issueMessage = false;
@@ -58,8 +57,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const &args,
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0055))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0055)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0055) << "\n";
break;
case cmPolicies::OLD:
issueMessage = false;
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 9662fbf..3c878bf 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -111,7 +111,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
// Lookup the policy number.
cmPolicies::PolicyID pid;
- if(!this->Makefile->GetPolicies()->GetPolicyID(id.c_str(), pid))
+ if(!cmPolicies::GetPolicyID(id.c_str(), pid))
{
std::ostringstream e;
e << "GET given policy \"" << id << "\" which is not known to this "
@@ -141,7 +141,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
// The policy is required to be set before anything needs it.
{
std::ostringstream e;
- e << this->Makefile->GetPolicies()->GetRequiredPolicyError(pid)
+ e << cmPolicies::GetRequiredPolicyError(pid)
<< "\n"
<< "The call to cmake_policy(GET " << id << " ...) at which this "
<< "error appears requests the policy, and this version of CMake "
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 6689243..0548c6b 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -180,7 +180,7 @@ public:
{
case cmPolicies::WARN:
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
- this->Makefile->GetPolicies()->GetPolicyWarning(pol));
+ cmPolicies::GetPolicyWarning(pol));
case cmPolicies::OLD:
return false;
case cmPolicies::REQUIRED_IF_USED:
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6ecf0dc..3c90ae2 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -556,8 +556,7 @@ bool cmComputeLinkInformation::Compute()
if (!this->CMP0060WarnItems.empty())
{
std::ostringstream w;
- w << (this->Makefile->GetCMakeInstance()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0060)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n"
"Some library files are in directories implicitly searched by "
"the linker when invoked for " << this->LinkLanguage << ":\n"
" " << cmJoin(this->CMP0060WarnItems, "\n ") << "\n"
@@ -1534,8 +1533,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
{
this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
std::ostringstream w;
- w << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
@@ -1553,8 +1551,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
- e << (this->Makefile->GetPolicies()->
- GetRequiredPolicyError(cmPolicies::CMP0008)) << "\n"
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n"
<< "Target \"" << this->Target->GetName() << "\" links to item\n"
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
@@ -1600,8 +1597,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
- e << (this->Makefile->GetPolicies()->
- GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n";
this->PrintLinkPolicyDiagnosis(e);
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace());
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 11056cd..c7be221 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -361,15 +361,13 @@ void cmComputeTargetDepends::AddTargetDepend(
if(!dependee && !linking &&
(depender->GetType() != cmTarget::GLOBAL_TARGET))
{
- cmMakefile *makefile = depender->GetMakefile();
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
std::ostringstream e;
switch(depender->GetPolicyStatusCMP0046())
{
case cmPolicies::WARN:
- e << (makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
issueMessage = true;
case cmPolicies::OLD:
break;
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 1f9b9d4..73aface 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -118,8 +118,7 @@ const char* cmConditionEvaluator::GetDefinitionIfUnquoted(
if(!hasBeenReported)
{
std::ostringstream e;
- e << (this->Makefile.GetPolicies()->GetPolicyWarning(
- cmPolicies::CMP0054)) << "\n";
+ e << (cmPolicies::GetPolicyWarning(cmPolicies::CMP0054)) << "\n";
e << "Quoted variables like \"" << argument.GetValue() <<
"\" will no longer be dereferenced "
"when the policy is set to NEW. "
@@ -168,8 +167,7 @@ bool cmConditionEvaluator::IsKeyword(std::string const& keyword,
if(!hasBeenReported)
{
std::ostringstream e;
- e << (this->Makefile.GetPolicies()->GetPolicyWarning(
- cmPolicies::CMP0054)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0054) << "\n";
e << "Quoted keywords like \"" << argument.GetValue() <<
"\" will no longer be interpreted as keywords "
"when the policy is set to NEW. "
@@ -280,10 +278,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference(
{
case cmPolicies::WARN:
{
- cmPolicies* policies = this->Makefile.GetPolicies();
errorString = "An argument named \"" + newArg.GetValue()
+ "\" appears in a conditional statement. "
- + policies->GetPolicyWarning(cmPolicies::CMP0012);
+ + cmPolicies::GetPolicyWarning(cmPolicies::CMP0012);
status = cmake::AUTHOR_WARNING;
}
case cmPolicies::OLD:
@@ -291,10 +288,9 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference(
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
- cmPolicies* policies = this->Makefile.GetPolicies();
errorString = "An argument named \"" + newArg.GetValue()
+ "\" appears in a conditional statement. "
- + policies->GetRequiredPolicyError(cmPolicies::CMP0012);
+ + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012);
status = cmake::FATAL_ERROR;
}
case cmPolicies::NEW:
@@ -493,8 +489,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs,
{
cmPolicies::PolicyID pid;
this->HandlePredicate(
- this->Makefile.GetPolicies()->GetPolicyID(
- argP1->c_str(), pid),
+ cmPolicies::GetPolicyID(argP1->c_str(), pid),
reducible, arg, newArgs, argP1, argP2);
}
// does a target exist
@@ -702,8 +697,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs,
else if(this->Policy57Status == cmPolicies::WARN)
{
std::ostringstream e;
- e << (this->Makefile.GetPolicies()->GetPolicyWarning(
- cmPolicies::CMP0057)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057) << "\n";
e << "IN_LIST will be interpreted as an operator "
"when the policy is set to NEW. "
"Since the policy is not set the OLD behavior will be used.";
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 56a884c..1109aca 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -334,8 +334,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
"CMAKE_POLICY_WARNING_CMP0056"))
{
std::ostringstream w;
- w << (this->Makefile->GetCMakeInstance()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0056)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n"
"For compatibility with older versions of CMake, try_compile "
"is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) "
"in the test project."
@@ -349,8 +348,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
case cmPolicies::REQUIRED_ALWAYS:
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
- this->Makefile->GetCMakeInstance()->GetPolicies()
- ->GetRequiredPolicyError(cmPolicies::CMP0056)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0056)
);
case cmPolicies::NEW:
// NEW behavior is to pass linker flags.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index b4fad98..a51fb2a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -257,8 +257,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{
case cmPolicies::WARN:
messageType = cmake::WARNING;
- e << target->GetMakefile()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0041) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n";
break;
case cmPolicies::OLD:
continue;
@@ -306,8 +305,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
case cmPolicies::WARN:
{
std::ostringstream s;
- s << target->GetMakefile()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
+ s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n";
s << "Directory:\n \"" << *li << "\"\nin "
"INTERFACE_INCLUDE_DIRECTORIES of target \""
<< target->GetName() << "\" is a subdirectory of the install "
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 14f397c..f695393 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1056,16 +1056,14 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
if(g.GetFollowedSymlinkCount() != 0)
{
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
- this->Makefile->GetPolicies()->
- GetPolicyWarning(cmPolicies::CMP0009));
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
}
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
this->SetError("policy CMP0009 error");
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
- this->Makefile->GetPolicies()->
- GetRequiredPolicyError(cmPolicies::CMP0009));
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0009));
return false;
}
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 2654851..7cfef02 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -395,8 +395,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
case cmPolicies::WARN:
{
std::ostringstream e;
- e << context->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0044);
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044);
context->Makefile->GetCMakeInstance()
->IssueMessage(cmake::AUTHOR_WARNING,
e.str(), context->Backtrace);
@@ -1495,8 +1494,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
{
case cmPolicies::WARN:
mf->IssueMessage(cmake::AUTHOR_WARNING,
- mf->GetPolicies()->
- GetPolicyWarning(policyForString(policy)));
+ cmPolicies::GetPolicyWarning(policyForString(policy)));
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::OLD:
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index eed19f4..315e851 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -56,8 +56,7 @@ bool cmGetTargetPropertyCommand
{
case cmPolicies::WARN:
issueMessage = true;
- e << this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0045) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n";
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_IF_USED:
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cf3a037..1c90537 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -826,7 +826,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
if(strcmp(compilerId, "AppleClang") == 0)
{
- cmPolicies* policies = this->CMakeInstance->GetPolicies();
switch(mf->GetPolicyStatus(cmPolicies::CMP0025))
{
case cmPolicies::WARN:
@@ -834,7 +833,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025"))
{
std::ostringstream w;
- w << policies->GetPolicyWarning(cmPolicies::CMP0025) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n"
"Converting " << lang <<
" compiler id \"AppleClang\" to \"Clang\" for compatibility."
;
@@ -848,7 +847,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
case cmPolicies::REQUIRED_ALWAYS:
mf->IssueMessage(
cmake::FATAL_ERROR,
- policies->GetRequiredPolicyError(cmPolicies::CMP0025)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025)
);
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
@@ -858,7 +857,6 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
if(strcmp(compilerId, "QCC") == 0)
{
- cmPolicies* policies = this->CMakeInstance->GetPolicies();
switch(mf->GetPolicyStatus(cmPolicies::CMP0047))
{
case cmPolicies::WARN:
@@ -866,7 +864,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047"))
{
std::ostringstream w;
- w << policies->GetPolicyWarning(cmPolicies::CMP0047) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n"
"Converting " << lang <<
" compiler id \"QCC\" to \"GNU\" for compatibility."
;
@@ -888,7 +886,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
case cmPolicies::REQUIRED_ALWAYS:
mf->IssueMessage(
cmake::FATAL_ERROR,
- policies->GetRequiredPolicyError(cmPolicies::CMP0047)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0047)
);
case cmPolicies::NEW:
// NEW behavior is to keep QCC.
@@ -1327,9 +1325,7 @@ void cmGlobalGenerator::Generate()
if(!this->CMP0042WarnTargets.empty())
{
std::ostringstream w;
- w <<
- (this->GetCMakeInstance()->GetPolicies()->
- GetPolicyWarning(cmPolicies::CMP0042)) << "\n";
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042) << "\n";
w << "MACOSX_RPATH is not specified for"
" the following targets:\n";
for(std::set<std::string>::iterator
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 074c4d1..678d60b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1103,9 +1103,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
if (!warnExplicitDepends.empty())
{
std::ostringstream w;
- w <<
- (this->GetCMakeInstance()->GetPolicies()->
- GetPolicyWarning(cmPolicies::CMP0058)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n"
"This project specifies custom command DEPENDS on files "
"in the build tree that are not specified as the OUTPUT or "
"BYPRODUCTS of any add_custom_command or add_custom_target:\n"
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index 71dabaf..ce04d3e 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -104,8 +104,7 @@ bool cmIncludeCommand
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n";
modal = "should";
case cmPolicies::OLD:
break;
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index fac9641..f1e0eb8 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1404,7 +1404,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure)
{
this->Makefile->IssueMessage(
cmake::AUTHOR_WARNING,
- this->Makefile->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0006)
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0006)
);
}
case cmPolicies::OLD:
@@ -1418,8 +1418,7 @@ bool cmInstallCommand::CheckCMP0006(bool& failure)
failure = true;
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
- this->Makefile->GetPolicies()
- ->GetRequiredPolicyError(cmPolicies::CMP0006)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0006)
);
break;
}
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index a21f517..f486bf7 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -40,18 +40,17 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
e << "This command specifies the relative path\n"
<< " " << unixPath << "\n"
<< "as a link directory.\n";
- cmPolicies* policies = this->Makefile->GetPolicies();
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015))
{
case cmPolicies::WARN:
- e << policies->GetPolicyWarning(cmPolicies::CMP0015);
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015);
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
case cmPolicies::OLD:
// OLD behavior does not convert
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
- e << policies->GetRequiredPolicyError(cmPolicies::CMP0015);
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0015);
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
case cmPolicies::NEW:
// NEW behavior converts
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index d18269d..f96b4a8 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -121,8 +121,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
// empty values
list.clear();
cmSystemTools::ExpandListArgument(listString, list);
- std::string warn = this->Makefile->GetPolicies()->
- GetPolicyWarning(cmPolicies::CMP0007);
+ std::string warn = cmPolicies::GetPolicyWarning(cmPolicies::CMP0007);
warn += " List has value = [";
warn += listString;
warn += "].";
@@ -143,8 +142,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
case cmPolicies::REQUIRED_ALWAYS:
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
- this->Makefile->GetPolicies()
- ->GetRequiredPolicyError(cmPolicies::CMP0007)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0007)
);
return false;
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6b705e8..88c88cd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -209,7 +209,7 @@ void cmLocalGenerator::ReadInputFile()
<< "to work accidentally and is being allowed for "
<< "compatibility."
<< "\n"
- << mf->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0014);
+ << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
mf->IssueMessage(cmake::AUTHOR_WARNING, e.str());
case cmPolicies::OLD:
// OLD behavior does not warn.
@@ -217,7 +217,7 @@ void cmLocalGenerator::ReadInputFile()
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
e << "\n"
- << mf->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0014);
+ << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014);
case cmPolicies::NEW:
// NEW behavior prints the error.
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -2458,8 +2458,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
"shared libraries and will use the " << flagsVar << " variable "
"instead. This may cause errors if the original content of "
<< flagsVar << " was removed.\n"
- << this->Makefile->GetPolicies()->GetPolicyWarning(
- cmPolicies::CMP0018);
+ << cmPolicies::GetPolicyWarning(cmPolicies::CMP0018);
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
// fall through to OLD behaviour
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5686b1b..29d891c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -591,14 +591,13 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
{
// We check the setting of this policy again because the included
// script might actually set this policy for its includer.
- cmPolicies* policies = this->Makefile->GetPolicies();
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0011))
{
case cmPolicies::WARN:
// Warn because the user did not set this policy.
{
std::ostringstream w;
- w << policies->GetPolicyWarning(cmPolicies::CMP0011) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n"
<< "The included script\n " << this->File << "\n"
<< "affects policy settings. "
<< "CMake is implying the NO_POLICY_SCOPE option for compatibility, "
@@ -610,7 +609,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011()
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
- e << policies->GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n"
<< "The included script\n " << this->File << "\n"
<< "affects policy settings, so it requires this policy to be set.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
@@ -879,8 +878,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
switch(this->GetPolicyStatus(cmPolicies::CMP0040))
{
case cmPolicies::WARN:
- e << (this->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0040) << "\n";
issueMessage = true;
case cmPolicies::OLD:
break;
@@ -1438,7 +1436,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
case cmPolicies::WARN:
this->IssueMessage(
cmake::AUTHOR_WARNING,
- this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0005)
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0005)
);
case cmPolicies::OLD:
// OLD behavior is to not escape the value. We should not
@@ -1448,7 +1446,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
case cmPolicies::REQUIRED_ALWAYS:
this->IssueMessage(
cmake::FATAL_ERROR,
- this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0005)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0005)
);
return false;
case cmPolicies::NEW:
@@ -2335,7 +2333,7 @@ void cmMakefile::ExpandVariablesCMP0019()
if(!w.str().empty())
{
std::ostringstream m;
- m << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0019)
+ m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019)
<< "\n"
<< "The following variable evaluations were encountered:\n"
<< w.str();
@@ -2593,7 +2591,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
else if(compareResults && (newResult != source || newError != mtype))
{
std::string msg =
- this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0053);
+ cmPolicies::GetPolicyWarning(cmPolicies::CMP0053);
msg += "\n";
std::string msg_input = original;
@@ -2745,9 +2743,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
switch(this->GetPolicyStatus(cmPolicies::CMP0010))
{
case cmPolicies::WARN:
- error << "\n"
- << (this->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0010));
+ error << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0010);
case cmPolicies::OLD:
// OLD behavior is to just warn and continue.
mtype = cmake::AUTHOR_WARNING;
@@ -2755,8 +2751,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringOld(
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
error << "\n"
- << (this->GetPolicies()
- ->GetRequiredPolicyError(cmPolicies::CMP0010));
+ << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010);
case cmPolicies::NEW:
// NEW behavior is to report the error.
break;
@@ -3820,7 +3815,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
<< moduleInCMakeModulePath
<< " (found via CMAKE_MODULE_PATH) which shadows "
<< moduleInCMakeRoot << ". This may cause errors later on .\n"
- << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0017);
+ << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017);
this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
// break; // fall through to OLD behaviour
@@ -4188,7 +4183,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
switch(this->GetPolicyStatus(cmPolicies::CMP0059))
{
case cmPolicies::WARN:
- this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()->
+ this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies::
GetPolicyWarning(cmPolicies::CMP0059));
case cmPolicies::OLD:
output += this->DefineFlagsOrig;
@@ -4558,14 +4553,14 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
switch (this->GetPolicyStatus(cmPolicies::CMP0002))
{
case cmPolicies::WARN:
- this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()->
+ this->IssueMessage(cmake::AUTHOR_WARNING, cmPolicies::
GetPolicyWarning(cmPolicies::CMP0002));
case cmPolicies::OLD:
return true;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
this->IssueMessage(cmake::FATAL_ERROR,
- this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0002)
+ cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0002)
);
return true;
case cmPolicies::NEW:
@@ -4637,7 +4632,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
{
case cmPolicies::WARN:
// Print the warning.
- e << this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0013)
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013)
<< "\n"
<< "The binary directory\n"
<< " " << binPath << "\n"
@@ -4654,7 +4649,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath,
return true;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
- e << this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0013)
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0013)
<< "\n";
case cmPolicies::NEW:
// NEW behavior prints the error.
@@ -4757,7 +4752,7 @@ cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const
{
return cur;
}
- cmPolicies::PolicyStatus def = this->GetPolicies()->GetPolicyStatus(id);
+ cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id);
if(def == cmPolicies::REQUIRED_ALWAYS ||
def == cmPolicies::REQUIRED_IF_USED)
{
@@ -4792,7 +4787,7 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
}
// The policy is not set. Use the default for this CMake version.
- return this->GetPolicies()->GetPolicyStatus(id);
+ return cmPolicies::GetPolicyStatus(id);
}
//----------------------------------------------------------------------------
@@ -4815,7 +4810,7 @@ bool cmMakefile::SetPolicy(const char *id,
cmPolicies::PolicyStatus status)
{
cmPolicies::PolicyID pid;
- if (!this->GetPolicies()->GetPolicyID(id, /* out */ pid))
+ if (!cmPolicies::GetPolicyID(id, /* out */ pid))
{
std::ostringstream e;
e << "Policy \"" << id << "\" is not known to this version of CMake.";
@@ -4831,11 +4826,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
{
// A REQUIRED_ALWAYS policy may be set only to NEW.
if(status != cmPolicies::NEW &&
- this->GetPolicies()->GetPolicyStatus(id) ==
+ cmPolicies::GetPolicyStatus(id) ==
cmPolicies::REQUIRED_ALWAYS)
{
std::string msg =
- this->GetPolicies()->GetRequiredAlwaysPolicyError(id);
+ cmPolicies::GetRequiredAlwaysPolicyError(id);
this->IssueMessage(cmake::FATAL_ERROR, msg);
return false;
}
@@ -4937,18 +4932,7 @@ void cmMakefile::PopPolicyBarrier(bool reportError)
//----------------------------------------------------------------------------
bool cmMakefile::SetPolicyVersion(const char *version)
{
- return this->GetCMakeInstance()->GetPolicies()->
- ApplyPolicyVersion(this,version);
-}
-
-//----------------------------------------------------------------------------
-cmPolicies *cmMakefile::GetPolicies() const
-{
- if (!this->GetCMakeInstance())
- {
- return 0;
- }
- return this->GetCMakeInstance()->GetPolicies();
+ return cmPolicies::ApplyPolicyVersion(this,version);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index afacc1b..a9029a0 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -216,8 +216,7 @@ bool cmProjectCommand
if(!vw.empty())
{
std::ostringstream w;
- w << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0048))
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0048)
<< "\nThe following variable(s) would be set to empty:" << vw;
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f69e9ae..8d1367e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -974,8 +974,7 @@ std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s)
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0049)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0049) << "\n";
break;
case cmPolicies::OLD:
noMessage = true;
@@ -2008,8 +2007,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
switch(tgt->GetPolicyStatusCMP0027())
{
case cmPolicies::WARN:
- e << (mf->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0027)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
case cmPolicies::OLD:
messageType = cmake::AUTHOR_WARNING;
break;
@@ -2049,8 +2047,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
{
case cmPolicies::WARN:
{
- e << (mf->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0021)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0021) << "\n";
messageType = cmake::AUTHOR_WARNING;
}
break;
@@ -2398,8 +2395,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
case cmPolicies::WARN:
{
std::ostringstream e;
- e << this->Makefile->GetCMakeInstance()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0043);
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING,
e.str());
}
@@ -2874,8 +2870,7 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
switch (context->GetPolicyStatus(cmPolicies::CMP0026))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
modal = "should";
case cmPolicies::OLD:
break;
@@ -3138,8 +3133,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
switch(context->GetPolicyStatus(cmPolicies::CMP0051))
{
case cmPolicies::WARN:
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0051)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n";
noMessage = false;
case cmPolicies::OLD:
break;
@@ -3236,8 +3230,7 @@ public:
{
case cmPolicies::WARN:
{
- e << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0028) << "\n";
messageType = cmake::AUTHOR_WARNING;
}
break;
@@ -5993,9 +5986,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
&& strcmp(newExplicitLibraries, explicitLibraries) != 0)
{
std::ostringstream w;
- w <<
- (thisTarget->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << thisTarget->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property which differs from its " <<
linkIfaceProp << " properties."
@@ -6064,9 +6055,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
{ newLibraries = "(empty)"; }
std::ostringstream w;
- w <<
- (thisTarget->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n"
"Target \"" << thisTarget->GetName() << "\" has an "
"INTERFACE_LINK_LIBRARIES property. "
"This should be preferred as the source of the link interface "
@@ -6323,8 +6312,7 @@ cmTargetInternals::ComputeLinkImplementationLibraries(
{
case cmPolicies::WARN:
{
- e << (thisTarget->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0038)) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0038) << "\n";
messageType = cmake::AUTHOR_WARNING;
}
break;
@@ -6461,8 +6449,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
case cmPolicies::WARN:
{
std::ostringstream w;
- w << (this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0004)) << "\n"
+ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0004) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
@@ -6483,8 +6470,7 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
case cmPolicies::REQUIRED_ALWAYS:
{
std::ostringstream e;
- e << (this->Makefile->GetPolicies()
- ->GetRequiredPolicyError(cmPolicies::CMP0004)) << "\n"
+ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0004) << "\n"
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 9be7d46..df37d66 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -58,16 +58,14 @@ bool cmTargetLinkLibrariesCommand
e << "\n"
<< "CMake does not support this but it used to work accidentally "
<< "and is being allowed for compatibility."
- << "\n" << this->Makefile->GetPolicies()->
- GetPolicyWarning(cmPolicies::CMP0016);
+ << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0016);
break;
case cmPolicies::OLD: // OLD behavior does not warn.
t = cmake::MESSAGE;
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
- e << "\n" << this->Makefile->GetPolicies()->
- GetRequiredPolicyError(cmPolicies::CMP0016);
+ e << "\n" << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0016);
break;
case cmPolicies::NEW: // NEW behavior prints the error.
break;
@@ -108,8 +106,7 @@ bool cmTargetLinkLibrariesCommand
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039))
{
case cmPolicies::WARN:
- e << this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0039) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n";
modal = "should";
case cmPolicies::OLD:
break;
@@ -379,8 +376,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023))
{
case cmPolicies::WARN:
- e << this->Makefile->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0023) << "\n";
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n";
modal = "should";
case cmPolicies::OLD:
break;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2334325421903c977c1e8842223629c02269145f
commit 2334325421903c977c1e8842223629c02269145f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:11:05 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:40:34 2015 +0200
cmPolicies: Make all API static.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 73e561c..b0dfa36 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -228,7 +228,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
{
if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer))
{
- if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS)
+ if(cmPolicies::GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS)
{
ancientPolicies.push_back(pid);
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 1e2849d..fee7dd9 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -250,22 +250,22 @@ public:
};
///! convert a string policy ID into a number
- bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
+ static bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
///! Get the default status for a policy
- cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
+ static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
///! Set a policy level for this listfile
- bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
+ static bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
///! return a warning string for a given policy
- std::string GetPolicyWarning(cmPolicies::PolicyID id);
+ static std::string GetPolicyWarning(cmPolicies::PolicyID id);
///! return an error string for when a required policy is unspecified
- std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
+ static std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
///! return an error string for when a required policy is unspecified
- std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
+ static std::string GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id);
/** Represent a set of policy values. */
typedef std::map<PolicyID, PolicyStatus> PolicyMap;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=275a0404be55bfdda06346b72d9d30348b5c15bd
commit 275a0404be55bfdda06346b72d9d30348b5c15bd
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:11:01 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:39:08 2015 +0200
cmPolicies: Remove unused DefinePolicy method.
Policies are no longer defined at runtime.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 2376ec5..73e561c 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -106,16 +106,6 @@ const char* idToShortDescription(cmPolicies::PolicyID id)
return 0;
}
-void cmPolicies::DefinePolicy(cmPolicies::PolicyID,
- const char *,
- const char *,
- unsigned int,
- unsigned int,
- unsigned int,
- cmPolicies::PolicyStatus)
-{
-}
-
//----------------------------------------------------------------------------
static void DiagnoseAncientPolicies(
std::vector<cmPolicies::PolicyID> const& ancient,
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 50ffe81..1e2849d 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -255,15 +255,6 @@ public:
///! Get the default status for a policy
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
- ///! Define a Policy for CMake
- void DefinePolicy(cmPolicies::PolicyID id,
- const char *stringID,
- const char *shortDescription,
- unsigned int majorVersionIntroduced,
- unsigned int minorVersionIntroduced,
- unsigned int patchVersionIntroduced,
- cmPolicies::PolicyStatus status);
-
///! Set a policy level for this listfile
bool ApplyPolicyVersion(cmMakefile *mf, const char *version);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab89036c52258f75637adf3f4650a5fbf38f8033
commit ab89036c52258f75637adf3f4650a5fbf38f8033
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:42 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:38:35 2015 +0200
cmPolicies: Remove unused cmPolicy class.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3ded35c..2376ec5 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -106,337 +106,7 @@ const char* idToShortDescription(cmPolicies::PolicyID id)
return 0;
}
-class cmPolicy
-{
-public:
- cmPolicy(cmPolicies::PolicyID iD)
- {
- this->ID = iD;
- }
-
- cmPolicies::PolicyID ID;
-};
-
-cmPolicies::cmPolicies()
-{
- // define all the policies
- this->DefinePolicy(
- CMP0000, "CMP0000",
- "A minimum required CMake version must be specified.",
- 2,6,0, cmPolicies::WARN
- );
-
- this->DefinePolicy(
- CMP0001, "CMP0001",
- "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.",
- 2,6,0, cmPolicies::WARN
- );
-
- this->DefinePolicy(
- CMP0002, "CMP0002",
- "Logical target names must be globally unique.",
- 2,6,0, cmPolicies::WARN
- );
-
- this->DefinePolicy(
- CMP0003, "CMP0003",
- "Libraries linked via full path no longer produce linker search paths.",
- 2,6,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0004, "CMP0004",
- "Libraries linked may not have leading or trailing whitespace.",
- 2,6,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0005, "CMP0005",
- "Preprocessor definition values are now escaped automatically.",
- 2,6,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0006, "CMP0006",
- "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.",
- 2,6,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0007, "CMP0007",
- "list command no longer ignores empty elements.",
- 2,6,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0008, "CMP0008",
- "Libraries linked by full-path must have a valid library file name.",
- 2,6,1, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0009, "CMP0009",
- "FILE GLOB_RECURSE calls should not follow symlinks by default.",
- 2,6,2, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0010, "CMP0010",
- "Bad variable reference syntax is an error.",
- 2,6,3, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0011, "CMP0011",
- "Included scripts do automatic cmake_policy PUSH and POP.",
- 2,6,3, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0012, "CMP0012",
- "if() recognizes numbers and boolean constants.",
- 2,8,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0013, "CMP0013",
- "Duplicate binary directories are not allowed.",
- 2,8,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0014, "CMP0014",
- "Input directories must have CMakeLists.txt.",
- 2,8,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0015, "CMP0015",
- "link_directories() treats paths relative to the source dir.",
- 2,8,1, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0016, "CMP0016",
- "target_link_libraries() reports error if its only argument "
- "is not a target.",
- 2,8,3, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0017, "CMP0017",
- "Prefer files from the CMake module directory when including from there.",
- 2,8,4, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0018, "CMP0018",
- "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.",
- 2,8,9, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0019, "CMP0019",
- "Do not re-expand variables in include and link information.",
- 2,8,11, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0020, "CMP0020",
- "Automatically link Qt executables to qtmain target on Windows.",
- 2,8,11, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0021, "CMP0021",
- "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.",
- 2,8,12, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0022, "CMP0022",
- "INTERFACE_LINK_LIBRARIES defines the link interface.",
- 2,8,12, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0023, "CMP0023",
- "Plain and keyword target_link_libraries signatures cannot be mixed.",
- 2,8,12, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0024, "CMP0024",
- "Disallow include export result.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0025, "CMP0025",
- "Compiler id for Apple Clang is now AppleClang.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0026, "CMP0026",
- "Disallow use of the LOCATION target property.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0027, "CMP0027",
- "Conditionally linked imported targets with missing include directories.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0028, "CMP0028",
- "Double colon in target name means ALIAS or IMPORTED target.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0029, "CMP0029",
- "The subdir_depends command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0030, "CMP0030",
- "The use_mangled_mesa command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0031, "CMP0031",
- "The load_command command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0032, "CMP0032",
- "The output_required_files command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0033, "CMP0033",
- "The export_library_dependencies command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0034, "CMP0034",
- "The utility_source command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0035, "CMP0035",
- "The variable_requires command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0036, "CMP0036",
- "The build_name command should not be called.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0037, "CMP0037",
- "Target names should not be reserved and should match a validity pattern.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0038, "CMP0038",
- "Targets may not link directly to themselves.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0039, "CMP0039",
- "Utility targets may not have link dependencies.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0040, "CMP0040",
- "The target in the TARGET signature of add_custom_command() must exist.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0041, "CMP0041",
- "Error on relative include with generator expression.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0042, "CMP0042",
- "MACOSX_RPATH is enabled by default.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0043, "CMP0043",
- "Ignore COMPILE_DEFINITIONS_<Config> properties.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0044, "CMP0044",
- "Case sensitive <LANG>_COMPILER_ID generator expressions.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0045, "CMP0045",
- "Error on non-existent target in get_target_property.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0046, "CMP0046",
- "Error on non-existent dependency in add_dependencies.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0047, "CMP0047",
- "Use QCC compiler id for the qcc drivers on QNX.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0048, "CMP0048",
- "project() command manages VERSION variables.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0049, "CMP0049",
- "Do not expand variables in target source entries.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0050, "CMP0050",
- "Disallow add_custom_command SOURCE signatures.",
- 3,0,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0051, "CMP0051",
- "List TARGET_OBJECTS in SOURCES target property.",
- 3,1,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0052, "CMP0052",
- "Reject source and build dirs in installed "
- "INTERFACE_INCLUDE_DIRECTORIES.",
- 3,1,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0053, "CMP0053",
- "Simplify variable reference and escape sequence evaluation.",
- 3,1,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0054, "CMP0054",
- "Only interpret if() arguments as variables or keywords when unquoted.",
- 3,1,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0055, "CMP0055",
- "Strict checking for break() command.",
- 3,2,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0056, "CMP0056",
- "Honor link flags in try_compile() source-file signature.",
- 3,2,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0058, "CMP0058",
- "Ninja requires custom command byproducts to be explicit.",
- 3,3,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0059, "CMP0059",
- "Do no treat DEFINITIONS as a built-in directory property.",
- 3,3,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0060, "CMP0060",
- "Link libraries by full path even in implicit directories.",
- 3,3,0, cmPolicies::WARN);
-
- this->DefinePolicy(
- CMP0057, "CMP0057",
- "Support new IN_LIST if() operator.",
- 3,3,0, cmPolicies::WARN);
-}
-
-cmPolicies::~cmPolicies()
-{
- cmDeleteAll(this->Policies);
-}
-
-void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
+void cmPolicies::DefinePolicy(cmPolicies::PolicyID,
const char *,
const char *,
unsigned int,
@@ -444,7 +114,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
unsigned int,
cmPolicies::PolicyStatus)
{
- this->Policies[iD] = new cmPolicy(iD);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 2b96939..50ffe81 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -223,9 +223,6 @@ class cmPolicy;
class cmPolicies
{
public:
- cmPolicies();
- ~cmPolicies();
-
/// Status of a policy
enum PolicyStatus {
OLD, ///< Use old behavior
@@ -281,10 +278,6 @@ public:
/** Represent a set of policy values. */
typedef std::map<PolicyID, PolicyStatus> PolicyMap;
-
- private:
- // might have to make these internal for VS6 not sure yet
- std::map<PolicyID,cmPolicy *> Policies;
};
#endif
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dec28e70dd37e89b6db1daa082ff9be601c3b36b
commit dec28e70dd37e89b6db1daa082ff9be601c3b36b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:42 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:36:36 2015 +0200
cmPolicies: Loop over all policies using enum constants.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 7a11d79..3ded35c 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -564,20 +564,20 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// now loop over all the policies and set them as appropriate
std::vector<cmPolicies::PolicyID> ancientPolicies;
- for(std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
- = this->Policies.begin(); i != this->Policies.end(); ++i)
+ for(PolicyID pid = cmPolicies::CMP0000;
+ pid != cmPolicies::CMPCOUNT; pid = PolicyID(pid+1))
{
- if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer))
+ if (isPolicyNewerThan(pid, majorVer, minorVer, patchVer))
{
- if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS)
+ if(this->GetPolicyStatus(pid) == cmPolicies::REQUIRED_ALWAYS)
{
- ancientPolicies.push_back(i->first);
+ ancientPolicies.push_back(pid);
}
else
{
cmPolicies::PolicyStatus status = cmPolicies::WARN;
- if(!GetPolicyDefault(mf, idToString(i->first), &status) ||
- !mf->SetPolicy(i->first, status))
+ if(!GetPolicyDefault(mf, idToString(pid), &status) ||
+ !mf->SetPolicy(pid, status))
{
return false;
}
@@ -585,7 +585,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
}
else
{
- if (!mf->SetPolicy(i->first, cmPolicies::NEW))
+ if (!mf->SetPolicy(pid, cmPolicies::NEW))
{
return false;
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82a80e5d9e6e4004e6786b38bba550382dfd3f63
commit 82a80e5d9e6e4004e6786b38bba550382dfd3f63
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:38 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:36:33 2015 +0200
cmPolicies: Trivialize GetPolicyStatus method.
It would be possible to implement this with an XMacro and switch
statement, but every codepath currently would still return WARN.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index f341fdd..7a11d79 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -109,15 +109,12 @@ const char* idToShortDescription(cmPolicies::PolicyID id)
class cmPolicy
{
public:
- cmPolicy(cmPolicies::PolicyID iD,
- cmPolicies::PolicyStatus status)
+ cmPolicy(cmPolicies::PolicyID iD)
{
this->ID = iD;
- this->Status = status;
}
cmPolicies::PolicyID ID;
- cmPolicies::PolicyStatus Status;
};
cmPolicies::cmPolicies()
@@ -445,10 +442,9 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
unsigned int,
unsigned int,
unsigned int,
- cmPolicies::PolicyStatus status)
+ cmPolicies::PolicyStatus)
{
- this->Policies[iD] = new cmPolicy(iD,
- status);
+ this->Policies[iD] = new cmPolicy(iD);
}
//----------------------------------------------------------------------------
@@ -649,18 +645,9 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
///! Get the default status for a policy
cmPolicies::PolicyStatus
-cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
+cmPolicies::GetPolicyStatus(cmPolicies::PolicyID)
{
- // if the policy is not know then what?
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
- this->Policies.find(id);
- if (pos == this->Policies.end())
- {
- // TODO is this right?
- return cmPolicies::WARN;
- }
-
- return pos->second->Status;
+ return cmPolicies::WARN;
}
//----------------------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9
commit 68bc1d79aa57bcd83c8b722a0d6ed45ada711aa9
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:27:36 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:36:30 2015 +0200
cmPolicies: Use more-direct ID access.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index a2aa104..f341fdd 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -581,7 +581,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
{
cmPolicies::PolicyStatus status = cmPolicies::WARN;
if(!GetPolicyDefault(mf, idToString(i->first), &status) ||
- !mf->SetPolicy(i->second->ID, status))
+ !mf->SetPolicy(i->first, status))
{
return false;
}
@@ -589,7 +589,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
}
else
{
- if (!mf->SetPolicy(i->second->ID, cmPolicies::NEW))
+ if (!mf->SetPolicy(i->first, cmPolicies::NEW))
{
return false;
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=92b31f19c1aac58d4e0a33d37f9b3bc3918d7099
commit 92b31f19c1aac58d4e0a33d37f9b3bc3918d7099
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:25:14 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:36:28 2015 +0200
cmPolicies: Implement in terms of public API.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index a2c7ad5..a2aa104 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -573,7 +573,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
{
if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer))
{
- if(i->second->Status == cmPolicies::REQUIRED_ALWAYS)
+ if(this->GetPolicyStatus(i->first) == cmPolicies::REQUIRED_ALWAYS)
{
ancientPolicies.push_back(i->first);
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a140aa6907b22dd17dbfc66102bbb6a089e4cf9a
commit a140aa6907b22dd17dbfc66102bbb6a089e4cf9a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:35 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:36:20 2015 +0200
cmPolicies: Make private method file-static.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 4b9f558..a2c7ad5 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -452,6 +452,31 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
}
//----------------------------------------------------------------------------
+static void DiagnoseAncientPolicies(
+ std::vector<cmPolicies::PolicyID> const& ancient,
+ unsigned int majorVer,
+ unsigned int minorVer,
+ unsigned int patchVer,
+ cmMakefile* mf)
+{
+ std::ostringstream e;
+ e << "The project requests behavior compatible with CMake version \""
+ << majorVer << "." << minorVer << "." << patchVer
+ << "\", which requires the OLD behavior for some policies:\n";
+ for(std::vector<cmPolicies::PolicyID>::const_iterator
+ i = ancient.begin(); i != ancient.end(); ++i)
+ {
+ e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n";
+ }
+ e << "However, this version of CMake no longer supports the OLD "
+ << "behavior for these policies. "
+ << "Please either update your CMakeLists.txt files to conform to "
+ << "the new behavior or use an older version of CMake that still "
+ << "supports the old behavior.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+//----------------------------------------------------------------------------
static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
cmPolicies::PolicyStatus* defaultSetting)
{
@@ -574,8 +599,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// Make sure the project does not use any ancient policies.
if(!ancientPolicies.empty())
{
- this->DiagnoseAncientPolicies(ancientPolicies,
- majorVer, minorVer, patchVer, mf);
+ DiagnoseAncientPolicies(ancientPolicies,
+ majorVer, minorVer, patchVer, mf);
cmSystemTools::SetFatalErrorOccured();
return false;
}
@@ -656,28 +681,3 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
<< "Run cmake --help-policy " << pid << " for more information.";
return e.str();
}
-
-//----------------------------------------------------------------------------
-void
-cmPolicies::DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
- unsigned int majorVer,
- unsigned int minorVer,
- unsigned int patchVer,
- cmMakefile* mf)
-{
- std::ostringstream e;
- e << "The project requests behavior compatible with CMake version \""
- << majorVer << "." << minorVer << "." << patchVer
- << "\", which requires the OLD behavior for some policies:\n";
- for(std::vector<PolicyID>::const_iterator
- i = ancient.begin(); i != ancient.end(); ++i)
- {
- e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n";
- }
- e << "However, this version of CMake no longer supports the OLD "
- << "behavior for these policies. "
- << "Please either update your CMakeLists.txt files to conform to "
- << "the new behavior or use an older version of CMake that still "
- << "supports the old behavior.";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
-}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index df04fdf..2b96939 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -285,10 +285,6 @@ public:
private:
// might have to make these internal for VS6 not sure yet
std::map<PolicyID,cmPolicy *> Policies;
-
- void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
- unsigned int majorVer, unsigned int minorVer,
- unsigned int patchVer, cmMakefile* mf);
};
#endif
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8de7d84c36b2519867dca9ca48d1c97512e9a07a
commit 8de7d84c36b2519867dca9ca48d1c97512e9a07a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:31 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:35:35 2015 +0200
cmPolicies: Implement short description access with XMacros.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 77935ab..4b9f558 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -34,6 +34,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
#define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \
CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION)
+#define CM_SELECT_ID_DOC(F, A1, A2, A3, A4, A5, A6) F(A1, A2)
+#define CM_FOR_EACH_POLICY_ID_DOC(POLICY) \
+ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_DOC)
+
static const char* idToString(cmPolicies::PolicyID id)
{
switch(id)
@@ -87,20 +91,32 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id,
return false;
}
+const char* idToShortDescription(cmPolicies::PolicyID id)
+{
+ switch(id)
+ {
+#define POLICY_CASE(ID, SHORT_DESCRIPTION) \
+ case cmPolicies::ID: \
+ return SHORT_DESCRIPTION;
+ CM_FOR_EACH_POLICY_ID_DOC(POLICY_CASE)
+#undef POLICY_CASE
+ case cmPolicies::CMPCOUNT:
+ return 0;
+ }
+ return 0;
+}
+
class cmPolicy
{
public:
cmPolicy(cmPolicies::PolicyID iD,
- const char *shortDescription,
cmPolicies::PolicyStatus status)
{
this->ID = iD;
- this->ShortDescription = shortDescription;
this->Status = status;
}
cmPolicies::PolicyID ID;
- std::string ShortDescription;
cmPolicies::PolicyStatus Status;
};
@@ -425,14 +441,13 @@ cmPolicies::~cmPolicies()
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
const char *,
- const char *shortDescription,
+ const char *,
unsigned int,
unsigned int,
unsigned int,
cmPolicies::PolicyStatus status)
{
this->Policies[iD] = new cmPolicy(iD,
- shortDescription,
status);
}
@@ -576,13 +591,10 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
///! return a warning string for a given policy
std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
- this->Policies.find(id);
-
std::ostringstream msg;
msg <<
"Policy " << idToString(id) << " is not set: "
- "" << pos->second->ShortDescription << " "
+ "" << idToShortDescription(id) << " "
"Run \"cmake --help-policy " << idToString(id) << "\" for "
"policy details. "
"Use the cmake_policy command to set the policy "
@@ -594,13 +606,10 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
///! return an error string for when a required policy is unspecified
std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
- this->Policies.find(id);
-
std::ostringstream error;
error <<
"Policy " << idToString(id) << " is not set to NEW: "
- "" << pos->second->ShortDescription << " "
+ "" << idToShortDescription(id) << " "
"Run \"cmake --help-policy " << idToString(id) << "\" for "
"policy details. "
"CMake now requires this policy to be set to NEW by the project. "
@@ -663,8 +672,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
for(std::vector<PolicyID>::const_iterator
i = ancient.begin(); i != ancient.end(); ++i)
{
- cmPolicy const* policy = this->Policies[*i];
- e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n";
+ e << " " << idToString(*i) << ": " << idToShortDescription(*i) << "\n";
}
e << "However, this version of CMake no longer supports the OLD "
<< "behavior for these policies. "
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a
commit b46cb9fe32aee6dde2cefda5c1ec77a8aad6f29a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:27 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:32 2015 +0200
cmPolicies: Implement version check with XMacro.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index f6589ae..77935ab 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -64,41 +64,43 @@ static const char* idToVersion(cmPolicies::PolicyID id)
return 0;
}
+static bool isPolicyNewerThan(cmPolicies::PolicyID id,
+ unsigned int majorV,
+ unsigned int minorV,
+ unsigned int patchV)
+{
+ switch(id)
+ {
+#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \
+ case cmPolicies::ID: \
+ return (majorV < V_MAJOR || \
+ (majorV == V_MAJOR && \
+ minorV + 1 < V_MINOR + 1) || \
+ (majorV == V_MAJOR && \
+ minorV == V_MINOR && \
+ patchV + 1 < V_PATCH + 1));
+ CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE)
+#undef POLICY_CASE
+ case cmPolicies::CMPCOUNT:
+ return false;
+ }
+ return false;
+}
+
class cmPolicy
{
public:
cmPolicy(cmPolicies::PolicyID iD,
const char *shortDescription,
- unsigned int majorVersionIntroduced,
- unsigned int minorVersionIntroduced,
- unsigned int patchVersionIntroduced,
cmPolicies::PolicyStatus status)
{
this->ID = iD;
this->ShortDescription = shortDescription;
- this->MajorVersionIntroduced = majorVersionIntroduced;
- this->MinorVersionIntroduced = minorVersionIntroduced;
- this->PatchVersionIntroduced = patchVersionIntroduced;
this->Status = status;
}
- bool IsPolicyNewerThan(unsigned int majorV,
- unsigned int minorV,
- unsigned int patchV)
- {
- return (majorV < this->MajorVersionIntroduced ||
- (majorV == this->MajorVersionIntroduced &&
- minorV < this->MinorVersionIntroduced) ||
- (majorV == this->MajorVersionIntroduced &&
- minorV == this->MinorVersionIntroduced &&
- patchV < this->PatchVersionIntroduced));
- }
-
cmPolicies::PolicyID ID;
std::string ShortDescription;
- unsigned int MajorVersionIntroduced;
- unsigned int MinorVersionIntroduced;
- unsigned int PatchVersionIntroduced;
cmPolicies::PolicyStatus Status;
};
@@ -424,16 +426,13 @@ cmPolicies::~cmPolicies()
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
const char *,
const char *shortDescription,
- unsigned int majorVersionIntroduced,
- unsigned int minorVersionIntroduced,
- unsigned int patchVersionIntroduced,
+ unsigned int,
+ unsigned int,
+ unsigned int,
cmPolicies::PolicyStatus status)
{
this->Policies[iD] = new cmPolicy(iD,
shortDescription,
- majorVersionIntroduced,
- minorVersionIntroduced,
- patchVersionIntroduced,
status);
}
@@ -532,7 +531,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
for(std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin(); i != this->Policies.end(); ++i)
{
- if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer))
+ if (isPolicyNewerThan(i->first, majorVer, minorVer, patchVer))
{
if(i->second->Status == cmPolicies::REQUIRED_ALWAYS)
{
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9273eadea728a0b63fe6acbcc634f5e71083dfaa
commit 9273eadea728a0b63fe6acbcc634f5e71083dfaa
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:20 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:32 2015 +0200
cmPolicies: Implement id to version with XMacro.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 74bb438..f6589ae 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -30,6 +30,10 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
return false;
}
+#define CM_SELECT_ID_VERSION(F, A1, A2, A3, A4, A5, A6) F(A1, A3, A4, A5)
+#define CM_FOR_EACH_POLICY_ID_VERSION(POLICY) \
+ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID_VERSION)
+
static const char* idToString(cmPolicies::PolicyID id)
{
switch(id)
@@ -45,6 +49,21 @@ static const char* idToString(cmPolicies::PolicyID id)
return 0;
}
+static const char* idToVersion(cmPolicies::PolicyID id)
+{
+ switch(id)
+ {
+#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \
+ case cmPolicies::ID: \
+ return #V_MAJOR "." #V_MINOR "." #V_PATCH;
+ CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE)
+#undef POLICY_CASE
+ case cmPolicies::CMPCOUNT:
+ return 0;
+ }
+ return 0;
+}
+
class cmPolicy
{
public:
@@ -63,17 +82,6 @@ public:
this->Status = status;
}
- std::string GetVersionString()
- {
- std::ostringstream v;
- v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced;
- if(this->PatchVersionIntroduced > 0)
- {
- v << "." << this->PatchVersionIntroduced;
- }
- return v.str();
- }
-
bool IsPolicyNewerThan(unsigned int majorV,
unsigned int minorV,
unsigned int patchV)
@@ -600,7 +608,7 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
"The policy may be set explicitly using the code\n"
" cmake_policy(SET " << idToString(id) << " NEW)\n"
"or by upgrading all policies with the code\n"
- " cmake_policy(VERSION " << pos->second->GetVersionString() <<
+ " cmake_policy(VERSION " << idToVersion(id) <<
") # or later\n"
"Run \"cmake --help-command cmake_policy\" for more information.";
return error.str();
@@ -631,7 +639,7 @@ cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
e << "Policy " << pid << " may not be set to OLD behavior because this "
<< "version of CMake no longer supports it. "
<< "The policy was introduced in "
- << "CMake version " << this->Policies[id]->GetVersionString()
+ << "CMake version " << idToVersion(id)
<< ", and use of NEW behavior is now required."
<< "\n"
<< "Please either update your CMakeLists.txt files to conform to "
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c58c7b825f1e1463f2246b8c273ddc9bd680603
commit 8c58c7b825f1e1463f2246b8c273ddc9bd680603
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:15 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:32 2015 +0200
cmPolicies: Implement id to string conversion with XMacro.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 51aea7b..74bb438 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -30,11 +30,25 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
return false;
}
+static const char* idToString(cmPolicies::PolicyID id)
+{
+ switch(id)
+ {
+#define POLICY_CASE(ID) \
+ case cmPolicies::ID: \
+ return #ID;
+ CM_FOR_EACH_POLICY_ID(POLICY_CASE)
+#undef POLICY_CASE
+ case cmPolicies::CMPCOUNT:
+ return 0;
+ }
+ return 0;
+}
+
class cmPolicy
{
public:
cmPolicy(cmPolicies::PolicyID iD,
- const char *idString,
const char *shortDescription,
unsigned int majorVersionIntroduced,
unsigned int minorVersionIntroduced,
@@ -42,7 +56,6 @@ public:
cmPolicies::PolicyStatus status)
{
this->ID = iD;
- this->IDString = idString;
this->ShortDescription = shortDescription;
this->MajorVersionIntroduced = majorVersionIntroduced;
this->MinorVersionIntroduced = minorVersionIntroduced;
@@ -74,7 +87,6 @@ public:
}
cmPolicies::PolicyID ID;
- std::string IDString;
std::string ShortDescription;
unsigned int MajorVersionIntroduced;
unsigned int MinorVersionIntroduced;
@@ -402,14 +414,14 @@ cmPolicies::~cmPolicies()
}
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
- const char *idString,
+ const char *,
const char *shortDescription,
unsigned int majorVersionIntroduced,
unsigned int minorVersionIntroduced,
unsigned int patchVersionIntroduced,
cmPolicies::PolicyStatus status)
{
- this->Policies[iD] = new cmPolicy(iD, idString,
+ this->Policies[iD] = new cmPolicy(iD,
shortDescription,
majorVersionIntroduced,
minorVersionIntroduced,
@@ -521,7 +533,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
else
{
cmPolicies::PolicyStatus status = cmPolicies::WARN;
- if(!GetPolicyDefault(mf, i->second->IDString, &status) ||
+ if(!GetPolicyDefault(mf, idToString(i->first), &status) ||
!mf->SetPolicy(i->second->ID, status))
{
return false;
@@ -554,18 +566,6 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
return stringToId(id, pid);
}
-std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
-{
- std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
- this->Policies.find(pid);
- if (pos == this->Policies.end())
- {
- return "";
- }
- return pos->second->IDString;
-}
-
-
///! return a warning string for a given policy
std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
{
@@ -574,9 +574,9 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
std::ostringstream msg;
msg <<
- "Policy " << pos->second->IDString << " is not set: "
+ "Policy " << idToString(id) << " is not set: "
"" << pos->second->ShortDescription << " "
- "Run \"cmake --help-policy " << pos->second->IDString << "\" for "
+ "Run \"cmake --help-policy " << idToString(id) << "\" for "
"policy details. "
"Use the cmake_policy command to set the policy "
"and suppress this warning.";
@@ -592,13 +592,13 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
std::ostringstream error;
error <<
- "Policy " << pos->second->IDString << " is not set to NEW: "
+ "Policy " << idToString(id) << " is not set to NEW: "
"" << pos->second->ShortDescription << " "
- "Run \"cmake --help-policy " << pos->second->IDString << "\" for "
+ "Run \"cmake --help-policy " << idToString(id) << "\" for "
"policy details. "
"CMake now requires this policy to be set to NEW by the project. "
"The policy may be set explicitly using the code\n"
- " cmake_policy(SET " << pos->second->IDString << " NEW)\n"
+ " cmake_policy(SET " << idToString(id) << " NEW)\n"
"or by upgrading all policies with the code\n"
" cmake_policy(VERSION " << pos->second->GetVersionString() <<
") # or later\n"
@@ -626,7 +626,7 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
std::string
cmPolicies::GetRequiredAlwaysPolicyError(cmPolicies::PolicyID id)
{
- std::string pid = this->GetPolicyIDString(id);
+ std::string pid = idToString(id);
std::ostringstream e;
e << "Policy " << pid << " may not be set to OLD behavior because this "
<< "version of CMake no longer supports it. "
@@ -657,7 +657,7 @@ cmPolicies::DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
i = ancient.begin(); i != ancient.end(); ++i)
{
cmPolicy const* policy = this->Policies[*i];
- e << " " << policy->IDString << ": " << policy->ShortDescription << "\n";
+ e << " " << idToString(*i) << ": " << policy->ShortDescription << "\n";
}
e << "However, this version of CMake no longer supports the OLD "
<< "behavior for these policies. "
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index e9881ac..df04fdf 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -254,7 +254,6 @@ public:
///! convert a string policy ID into a number
bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
- std::string GetPolicyIDString(cmPolicies::PolicyID pid);
///! Get the default status for a policy
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51662a178929cd6802008b282840077b1f87e61c
commit 51662a178929cd6802008b282840077b1f87e61c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:10:06 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:31 2015 +0200
cmPolicies: Introduce XMacro table for policy data.
Use it to populate the policy enum.
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a3654f1..e9881ac 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -17,6 +17,202 @@
class cmMakefile;
class cmPolicy;
+#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
+ SELECT(POLICY, CMP0000, \
+ "A minimum required CMake version must be specified.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0001, \
+ "CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0002, \
+ "Logical target names must be globally unique.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0003, \
+ "Libraries linked via full path no longer produce linker search paths.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0004, \
+ "Libraries linked may not have leading or trailing whitespace.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0005, \
+ "Preprocessor definition values are now escaped automatically.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0006, \
+ "Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0007, \
+ "list command no longer ignores empty elements.", \
+ 2, 6, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0008, \
+ "Libraries linked by full-path must have a valid library file name.", \
+ 2, 6, 1, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0009, \
+ "FILE GLOB_RECURSE calls should not follow symlinks by default.", \
+ 2, 6, 2, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0010, \
+ "Bad variable reference syntax is an error.", \
+ 2, 6, 3, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0011, \
+ "Included scripts do automatic cmake_policy PUSH and POP.", \
+ 2, 6, 3, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0012, \
+ "if() recognizes numbers and boolean constants.", \
+ 2, 8, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0013, \
+ "Duplicate binary directories are not allowed.", \
+ 2, 8, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0014, \
+ "Input directories must have CMakeLists.txt.", \
+ 2, 8, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0015, \
+ "link_directories() treats paths relative to the source dir.", \
+ 2, 8, 1, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0016, \
+ "target_link_libraries() reports error if its only argument " \
+ "is not a target.", \
+ 2, 8, 3, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0017, \
+ "Prefer files from the CMake module directory when including from " \
+ "there.", \
+ 2, 8, 4, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0018, \
+ "Ignore CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.", \
+ 2, 8, 9, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0019, \
+ "Do not re-expand variables in include and link information.", \
+ 2, 8, 11, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0020, \
+ "Automatically link Qt executables to qtmain target on Windows.", \
+ 2, 8, 11, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0021, \
+ "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.", \
+ 2, 8, 12, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0022, \
+ "INTERFACE_LINK_LIBRARIES defines the link interface.", \
+ 2, 8, 12, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0023, \
+ "Plain and keyword target_link_libraries signatures cannot be mixed.", \
+ 2, 8, 12, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0024, \
+ "Disallow include export result.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0025, \
+ "Compiler id for Apple Clang is now AppleClang.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0026, \
+ "Disallow use of the LOCATION target property.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0027, \
+ "Conditionally linked imported targets with missing include " \
+ "directories.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0028, \
+ "Double colon in target name means ALIAS or IMPORTED target.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0029, \
+ "The subdir_depends command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0030, \
+ "The use_mangled_mesa command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0031, \
+ "The load_command command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0032, \
+ "The output_required_files command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0033, \
+ "The export_library_dependencies command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0034, \
+ "The utility_source command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0035, \
+ "The variable_requires command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0036, \
+ "The build_name command should not be called.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0037, \
+ "Target names should not be reserved and should match a validity " \
+ "pattern.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0038, \
+ "Targets may not link directly to themselves.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0039, \
+ "Utility targets may not have link dependencies.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0040, \
+ "The target in the TARGET signature of add_custom_command() must " \
+ "exist.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0041, \
+ "Error on relative include with generator expression.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0042, \
+ "MACOSX_RPATH is enabled by default.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0043, \
+ "Ignore COMPILE_DEFINITIONS_<Config> properties.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0044, \
+ "Case sensitive <LANG>_COMPILER_ID generator expressions.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0045, \
+ "Error on non-existent target in get_target_property.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0046, \
+ "Error on non-existent dependency in add_dependencies.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0047, \
+ "Use QCC compiler id for the qcc drivers on QNX.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0048, \
+ "project() command manages VERSION variables.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0049, \
+ "Do not expand variables in target source entries.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0050, \
+ "Disallow add_custom_command SOURCE signatures.", \
+ 3, 0, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0051, \
+ "List TARGET_OBJECTS in SOURCES target property.", \
+ 3, 1, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0052, \
+ "Reject source and build dirs in installed " \
+ "INTERFACE_INCLUDE_DIRECTORIES.", \
+ 3, 1, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0053, \
+ "Simplify variable reference and escape sequence evaluation.", \
+ 3, 1, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0054, \
+ "Only interpret if() arguments as variables or keywords when unquoted.", \
+ 3, 1, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0055, \
+ "Strict checking for break() command.", \
+ 3, 2, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0056, \
+ "Honor link flags in try_compile() source-file signature.", \
+ 3, 2, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0057, \
+ "Support new IN_LIST if() operator.", \
+ 3, 3, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0058, \
+ "Ninja requires custom command byproducts to be explicit.", \
+ 3, 3, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0059, \
+ "Do no treat DEFINITIONS as a built-in directory property.", \
+ 3, 3, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0060, \
+ "Link libraries by full path even in implicit directories.", \
+ 3, 3, 0, cmPolicies::WARN)
+
+#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
+#define CM_FOR_EACH_POLICY_ID(POLICY) \
+ CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
+
+
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
*
@@ -44,78 +240,9 @@ public:
/// Policy identifiers
enum PolicyID
{
- CMP0000, ///< Policy version specification
- CMP0001, ///< Ignore old compatibility variable
- CMP0002, ///< Target names must be unique
- CMP0003, ///< Linking does not include extra -L paths
- CMP0004, ///< Libraries linked may not have leading or trailing whitespace
- CMP0005, ///< Definition value escaping
- CMP0006, ///< BUNDLE install rules needed for MACOSX_BUNDLE targets
- CMP0007, ///< list command handling of empty elements
- CMP0008, ///< Full-path libraries must be a valid library file name
- CMP0009, ///< GLOB_RECURSE should not follow symlinks by default
- CMP0010, ///< Bad variable reference syntax is an error
- CMP0011, ///< Strong policy scope for include and find_package
- CMP0012, ///< Recognize numbers and boolean constants in if()
- CMP0013, ///< Duplicate binary directories not allowed
- CMP0014, ///< Input directories must have CMakeLists.txt
- CMP0015, ///< link_directories() treats paths relative to source dir
- /// target_link_libraries() fails if only argument is not a target
- CMP0016,
- CMP0017, ///< Prefer files in CMAKE_ROOT when including from CMAKE_ROOT
- CMP0018, ///< Ignore language flags for shared libs, and adhere to
- /// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C}
- /// instead.
- CMP0019, ///< No variable re-expansion in include and link info
- CMP0020, ///< Automatically link Qt executables to qtmain target
- CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
- /// target property
- CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface
- CMP0023, ///< Disallow mixing keyword and plain tll signatures
- CMP0024, ///< Disallow including export() result.
- CMP0025, ///< Compiler id for Apple Clang is now AppleClang
- CMP0026, ///< Disallow use of the LOCATION target property.
- CMP0027, ///< Conditionally linked imported targets with missing include
- /// directories.
- CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target.
- CMP0029, ///< Disallow command: subdir_depends
- CMP0030, ///< Disallow command: use_mangled_mesa
- CMP0031, ///< Disallow command: load_command
- CMP0032, ///< Disallow command: output_required_files
- CMP0033, ///< Disallow command: export_library_dependencies
- CMP0034, ///< Disallow command: utility_source
- CMP0035, ///< Disallow command: variable_requires
- CMP0036, ///< Disallow command: build_name
- CMP0037, ///< Target names should not be reserved and
- /// should match a validity pattern.
- CMP0038, ///< Targets may not link directly to themselves
- CMP0039, ///< Utility targets may not have link dependencies
- CMP0040, ///< The target in the TARGET signature of
- /// add_custom_command() must exist.
- CMP0041, ///< Error on relative include with generator expression
- CMP0042, ///< Enable MACOSX_RPATH by default
- CMP0043, ///< Ignore COMPILE_DEFINITIONS_<Config> properties
- CMP0044, ///< Case sensitive <LANG>_COMPILER_ID generator expressions
- CMP0045, ///< Error on non-existent target in get_target_property
- CMP0046, ///< Error on non-existent dependency in add_dependencies
- CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX.
- CMP0048, ///< project() command manages VERSION variables
- CMP0049, ///< Do not expand variables in target source entries
- CMP0050, ///< Disallow add_custom_command SOURCE signatures
- CMP0051, ///< List TARGET_OBJECTS in SOURCES target property
- CMP0052, ///< Reject source and build dirs in installed
- /// INTERFACE_INCLUDE_DIRECTORIES
-
- CMP0053, ///< Simplify variable reference and escape sequence evaluation
- CMP0054, ///< Only interpret if() arguments as variables
- /// or keywords when unquoted.
- CMP0055, ///< Strict checking for break() command.
- CMP0056, ///< Honor link flags in try_compile() source-file signature.
- CMP0057, ///< Support new IN_LIST if() operator.
- CMP0058, ///< Ninja requires custom command byproducts to be explicit
- CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory
- /// property.
- CMP0060, ///< Link libraries by full path even in implicit directories.
+#define POLICY_ENUM(POLICY_ID) POLICY_ID,
+ CM_FOR_EACH_POLICY_ID(POLICY_ENUM)
+#undef POLICY_ENUM
/** \brief Always the last entry.
*
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76e5bd042ced3dab01e5d2c88a2199f09ca806ae
commit 76e5bd042ced3dab01e5d2c88a2199f09ca806ae
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:09:57 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:31 2015 +0200
cmPolicies: Implement more-compact IsPolicyNewerThan.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 372a079..51aea7b 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -65,23 +65,12 @@ public:
unsigned int minorV,
unsigned int patchV)
{
- if (majorV < this->MajorVersionIntroduced)
- {
- return true;
- }
- if (majorV > this->MajorVersionIntroduced)
- {
- return false;
- }
- if (minorV < this->MinorVersionIntroduced)
- {
- return true;
- }
- if (minorV > this->MinorVersionIntroduced)
- {
- return false;
- }
- return (patchV < this->PatchVersionIntroduced);
+ return (majorV < this->MajorVersionIntroduced ||
+ (majorV == this->MajorVersionIntroduced &&
+ minorV < this->MinorVersionIntroduced) ||
+ (majorV == this->MajorVersionIntroduced &&
+ minorV == this->MinorVersionIntroduced &&
+ patchV < this->PatchVersionIntroduced));
}
cmPolicies::PolicyID ID;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a
commit ecd17c8fb7fcc2baba6d6a76467dd3bf1048412a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:09:29 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:32:19 2015 +0200
cmPolicies: Parse string for id conversion.
Remove now-unused PolicyStringMap.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3f9c6f0..372a079 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -9,6 +9,27 @@
#include <queue>
#include <assert.h>
+static bool stringToId(const char* input, cmPolicies::PolicyID& pid)
+{
+ assert(input);
+ if (strlen(input) != 7)
+ {
+ return false;
+ }
+ if (cmHasLiteralPrefix(input, "CMP0000"))
+ {
+ pid = cmPolicies::CMP0000;
+ return true;
+ }
+ long id = strtol(input + 3, (char **)0, 10);
+ if (id != 0)
+ {
+ pid = cmPolicies::PolicyID(id);
+ return true;
+ }
+ return false;
+}
+
class cmPolicy
{
public:
@@ -405,7 +426,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
minorVersionIntroduced,
patchVersionIntroduced,
status);
- this->PolicyStringMap[idString] = iD;
}
//----------------------------------------------------------------------------
@@ -542,18 +562,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
- if (!id || strlen(id) < 1)
- {
- return false;
- }
- std::map<std::string,cmPolicies::PolicyID>::iterator pos =
- this->PolicyStringMap.find(id);
- if (pos == this->PolicyStringMap.end())
- {
- return false;
- }
- pid = pos->second;
- return true;
+ return stringToId(id, pid);
}
std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 9de0298..a3654f1 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -159,7 +159,6 @@ public:
private:
// might have to make these internal for VS6 not sure yet
std::map<PolicyID,cmPolicy *> Policies;
- std::map<std::string,PolicyID> PolicyStringMap;
void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
unsigned int majorVer, unsigned int minorVer,
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=953d1b00af3059b24c4dadf8c4717cb0d2260e36
commit 953d1b00af3059b24c4dadf8c4717cb0d2260e36
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:09:10 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:09:10 2015 +0200
cmPolicies: Make private method file-static.
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
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c10494ab3194e792ad69825cbb55d6644270dd0
commit 2c10494ab3194e792ad69825cbb55d6644270dd0
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:08:50 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:08:50 2015 +0200
cmPolicies: Remove runtime check for programming errors.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 0f1c27e..4b6ea5c 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -20,12 +20,6 @@ public:
unsigned int patchVersionIntroduced,
cmPolicies::PolicyStatus status)
{
- if (!idString || !shortDescription)
- {
- cmSystemTools::Error("Attempt to define a policy without "
- "all parameters being specified!");
- return;
- }
this->ID = iD;
this->IDString = idString;
this->ShortDescription = shortDescription;
@@ -405,14 +399,6 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
unsigned int patchVersionIntroduced,
cmPolicies::PolicyStatus status)
{
- // a policy must be unique and can only be defined once
- if (this->Policies.find(iD) != this->Policies.end())
- {
- cmSystemTools::Error("Attempt to redefine a CMake policy for policy "
- "ID ", this->GetPolicyIDString(iD).c_str());
- return;
- }
-
this->Policies[iD] = new cmPolicy(iD, idString,
shortDescription,
majorVersionIntroduced,
@@ -587,12 +573,6 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
{
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
- if (pos == this->Policies.end())
- {
- cmSystemTools::Error(
- "Request for warning text for undefined policy!");
- return "Request for warning text for undefined policy!";
- }
std::ostringstream msg;
msg <<
@@ -611,12 +591,6 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
{
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
- if (pos == this->Policies.end())
- {
- cmSystemTools::Error(
- "Request for error text for undefined policy!");
- return "Request for error text for undefined policy!";
- }
std::ostringstream error;
error <<
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78
commit 48f9fd39ad1637815cd89c2a2f2a17e43c0d7f78
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:08:35 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:08:35 2015 +0200
cmPolicies: Remove unused forward declaration.
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index dbad805..ba8a120 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -14,7 +14,6 @@
#include "cmCustomCommand.h"
-class cmake;
class cmMakefile;
class cmPolicy;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd0aa7434b010c496e09d8013b192b7df453979a
commit fd0aa7434b010c496e09d8013b192b7df453979a
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:08:04 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:08:04 2015 +0200
cmPolicies: Remove unused static data.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 5424876..0f1c27e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -9,10 +9,6 @@
#include <queue>
#include <assert.h>
-const char* cmPolicies::PolicyStatusNames[] = {
- "OLD", "WARN", "NEW", "REQUIRED_IF_USED", "REQUIRED_ALWAYS"
-};
-
class cmPolicy
{
public:
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 557880e..dbad805 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -41,7 +41,6 @@ public:
REQUIRED_IF_USED,
REQUIRED_ALWAYS ///< Issue an error unless user sets policy status to NEW.
};
- static const char* PolicyStatusNames[];
/// Policy identifiers
enum PolicyID
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3291fe8ecb95c891a34c1844557cbfa2bb89e2d
commit a3291fe8ecb95c891a34c1844557cbfa2bb89e2d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:07:58 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:07:58 2015 +0200
cmPolicies: Remove unused header.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 76990f0..5424876 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -1,7 +1,6 @@
#include "cmPolicies.h"
#include "cmake.h"
#include "cmMakefile.h"
-#include "cmSourceFile.h"
#include "cmVersion.h"
#include "cmVersionMacros.h"
#include "cmAlgorithms.h"
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6fb6db49d9fc5558fd79296fbc233f90a3063e4
commit a6fb6db49d9fc5558fd79296fbc233f90a3063e4
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun May 3 10:07:48 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sun May 3 10:07:48 2015 +0200
cmPolicies: Fix values for policies 57-60.
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ca82264..557880e 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -113,11 +113,11 @@ public:
/// or keywords when unquoted.
CMP0055, ///< Strict checking for break() command.
CMP0056, ///< Honor link flags in try_compile() source-file signature.
+ CMP0057, ///< Support new IN_LIST if() operator.
CMP0058, ///< Ninja requires custom command byproducts to be explicit
CMP0059, ///< Do not treat ``DEFINITIONS`` as a built-in directory
/// property.
CMP0060, ///< Link libraries by full path even in implicit directories.
- CMP0057, ///< Support new IN_LIST if() operator.
/** \brief Always the last entry.
*
-----------------------------------------------------------------------
Summary of changes:
Source/cmAddCustomCommandCommand.cxx | 3 +-
Source/cmAddCustomTargetCommand.cxx | 3 +-
Source/cmAddExecutableCommand.cxx | 3 +-
Source/cmAddLibraryCommand.cxx | 3 +-
Source/cmBreakCommand.cxx | 6 +-
Source/cmCMakePolicyCommand.cxx | 4 +-
Source/cmCommand.h | 2 +-
Source/cmComputeLinkInformation.cxx | 12 +-
Source/cmComputeTargetDepends.cxx | 4 +-
Source/cmConditionEvaluator.cxx | 18 +-
Source/cmCoreTryCompile.cxx | 6 +-
Source/cmExportFileGenerator.cxx | 6 +-
Source/cmFileCommand.cxx | 6 +-
Source/cmGeneratorExpressionNode.cxx | 6 +-
Source/cmGetTargetPropertyCommand.cxx | 3 +-
Source/cmGlobalGenerator.cxx | 14 +-
Source/cmGlobalNinjaGenerator.cxx | 4 +-
Source/cmIncludeCommand.cxx | 3 +-
Source/cmInstallCommand.cxx | 5 +-
Source/cmLinkDirectoriesCommand.cxx | 5 +-
Source/cmListCommand.cxx | 6 +-
Source/cmLocalGenerator.cxx | 7 +-
Source/cmMakefile.cxx | 69 ++-
Source/cmPolicies.cxx | 717 +++++++++----------------------
Source/cmPolicies.h | 323 +++++++++-----
Source/cmProjectCommand.cxx | 3 +-
Source/cmTarget.cxx | 38 +-
Source/cmTargetLinkLibrariesCommand.cxx | 12 +-
28 files changed, 500 insertions(+), 791 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list