summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-15 13:33:05 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-15 13:33:05 (GMT)
commitb31ca93ba2665c353ba723fecff55eaedf5fb569 (patch)
tree8c9bd5adbc725329f658707078cddfe959d73dea /Source/cmTarget.cxx
parent21ccad58fd5abae66b67baba200e2b6cb2402e91 (diff)
parente4e5b28c27dc2e6f0073e11fb64c4ea62022a051 (diff)
downloadCMake-b31ca93ba2665c353ba723fecff55eaedf5fb569.zip
CMake-b31ca93ba2665c353ba723fecff55eaedf5fb569.tar.gz
CMake-b31ca93ba2665c353ba723fecff55eaedf5fb569.tar.bz2
Merge topic 'target-LOCATION-policy'
e4e5b28 cmTarget: Deprecate the LOCATION target property with a policy.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index a1d9889..d03ed49 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4133,6 +4133,43 @@ const char *cmTarget::GetProperty(const char* prop)
}
//----------------------------------------------------------------------------
+bool cmTarget::HandleLocationPropertyPolicy()
+{
+ if (this->IsImported())
+ {
+ return true;
+ }
+ const char *modal = 0;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026))
+ {
+ case cmPolicies::WARN:
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ modal = "may";
+ messageType = cmake::FATAL_ERROR;
+ }
+
+ if (modal)
+ {
+ cmOStringStream e;
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n";
+ e << "The LOCATION property " << modal << " not be read from target \""
+ << this->GetName() << "\". Use the target name directly with "
+ "add_custom_command, or use the generator expression $<TARGET_FILE>, "
+ "as appropriate.\n";
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ }
+
+ return messageType != cmake::FATAL_ERROR;
+}
+
+//----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const char* prop,
cmProperty::ScopeType scope)
{
@@ -4157,6 +4194,11 @@ const char *cmTarget::GetProperty(const char* prop,
{
if(strcmp(prop,"LOCATION") == 0)
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
+
// Set the LOCATION property of the target.
//
// For an imported target this is the location of an arbitrary
@@ -4172,6 +4214,10 @@ const char *cmTarget::GetProperty(const char* prop,
// Support "LOCATION_<CONFIG>".
if(strncmp(prop, "LOCATION_", 9) == 0)
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
std::string configName = prop+9;
this->SetProperty(prop, this->GetLocation(configName.c_str()));
}
@@ -4184,6 +4230,10 @@ const char *cmTarget::GetProperty(const char* prop,
std::string configName(prop, len-9);
if(configName != "IMPORTED")
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
this->SetProperty(prop, this->GetLocation(configName.c_str()));
}
}