summaryrefslogtreecommitdiffstats
path: root/Source/cmGetTargetPropertyCommand.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-01-08 12:16:33 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-01-08 15:41:34 (GMT)
commit73e93400e2efab2096618ff58a5ad68236cd04aa (patch)
treebc144c3cd832a7afa9aab8d598ca82f6ac77da9e /Source/cmGetTargetPropertyCommand.cxx
parentab9f58f657a244d182ccd9a9361fae0a7c068f20 (diff)
downloadCMake-73e93400e2efab2096618ff58a5ad68236cd04aa.zip
CMake-73e93400e2efab2096618ff58a5ad68236cd04aa.tar.gz
CMake-73e93400e2efab2096618ff58a5ad68236cd04aa.tar.bz2
get_target_property: Error on non-existent target.
Introduce policy CMP0045 to control this behavior.
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 02f00a5..488cc28 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -40,7 +40,36 @@ bool cmGetTargetPropertyCommand
cmTarget& target = *tgt;
prop = target.GetProperty(args[2].c_str());
}
-
+ else
+ {
+ bool issueMessage = false;
+ cmOStringStream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0045))
+ {
+ case cmPolicies::WARN:
+ issueMessage = true;
+ e << this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0045) << "\n";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
+ }
+ if (issueMessage)
+ {
+ e << "get_target_property() called with non-existent target \""
+ << targetName << "\".";
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+ }
if (prop)
{
this->Makefile->AddDefinition(var.c_str(), prop);