summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-12 19:26:26 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-12 19:26:26 (GMT)
commit7b185d50170366ae57c43295db788ea2038a858b (patch)
treec00b473bcbecb9be0dc55ae11fcd47d55de21439 /Source
parentaddf4db06cb3d4e7482ed54a12a21aaa9110f6a4 (diff)
parent242c396656783b1b3d542b14bc62710a46a87518 (diff)
downloadCMake-7b185d50170366ae57c43295db788ea2038a858b.zip
CMake-7b185d50170366ae57c43295db788ea2038a858b.tar.gz
CMake-7b185d50170366ae57c43295db788ea2038a858b.tar.bz2
Merge topic 'main_dependency_diagnostic'
242c3966 add_custom_command: Diagnose MAIN_DEPENDENCY limitation.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx27
-rw-r--r--Source/cmPolicies.cxx5
-rw-r--r--Source/cmPolicies.h2
3 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ccfe2b1..6de1c61 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -985,6 +985,33 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
}
else
{
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ bool issueMessage = false;
+
+ switch(this->GetPolicyStatus(cmPolicies::CMP0057))
+ {
+ case cmPolicies::WARN:
+ e << (this->GetPolicies()->
+ GetPolicyWarning(cmPolicies::CMP0057)) << "\n";
+ issueMessage = true;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ issueMessage = true;
+ messageType = cmake::FATAL_ERROR;
+ break;
+ }
+
+ if(issueMessage)
+ {
+ e << "\"" << main_dependency << "\" can only be specified as a "
+ "custom command MAIN_DEPENDENCY once.";
+ IssueMessage(messageType, e.str());
+ }
+
// The existing custom command is different. We need to
// generate a rule file for this new command.
file = 0;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 3a48101..07e210e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -374,6 +374,11 @@ cmPolicies::cmPolicies()
CMP0056, "CMP0056",
"Honor link flags in try_compile() source-file signature.",
3,2,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0057, "CMP0057",
+ "Disallow multiple MAIN_DEPENDENCY specifications for the same file.",
+ 3,3,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index c393c2f..854b132 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -113,6 +113,8 @@ public:
/// or keywords when unquoted.
CMP0055, ///< Strict checking for break() command.
CMP0056, ///< Honor link flags in try_compile() source-file signature.
+ CMP0057, ///< Disallow multiple MAIN_DEPENDENCY specifications
+ /// for the same file.
/** \brief Always the last entry.
*