summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-11 17:39:55 (GMT)
committerBrad King <brad.king@kitware.com>2014-02-12 16:19:27 (GMT)
commitf2eee72facb9b4a658e1205bbe9113a808e76775 (patch)
treeb9ee09e297649dffb9dc656936a263f1384703c2 /Source
parentc248a437c47b4419fd955d4b1f406f7c8b9dcd74 (diff)
downloadCMake-f2eee72facb9b4a658e1205bbe9113a808e76775.zip
CMake-f2eee72facb9b4a658e1205bbe9113a808e76775.tar.gz
CMake-f2eee72facb9b4a658e1205bbe9113a808e76775.tar.bz2
add_custom_command: Disallow use of SOURCE signatures.
Add CMP0050 to control this behavior.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx30
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 5634849..3de04f5 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -344,6 +344,36 @@ bool cmAddCustomCommandCommand
}
else
{
+ bool issueMessage = true;
+ cmOStringStream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0050))
+ {
+ case cmPolicies::WARN:
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0050)) << "\n";
+ break;
+ case cmPolicies::OLD:
+ issueMessage = false;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ messageType = cmake::FATAL_ERROR;
+ break;
+ }
+
+ if (issueMessage)
+ {
+ e << "The SOURCE signatures of add_custom_command are no longer "
+ "supported.";
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+
// Use the old-style mode for backward compatibility.
this->Makefile->AddCustomCommandOldStyle(target.c_str(), outputs, depends,
source.c_str(), commandLines,
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 78453db..93072f5 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -338,6 +338,11 @@ cmPolicies::cmPolicies()
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);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 9523650..b77235d 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -103,6 +103,7 @@ public:
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
/** \brief Always the last entry.
*