summaryrefslogtreecommitdiff
path: root/Source/cmAddCustomTargetCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-03-07 15:30:35 -0500
committerBrad King <brad.king@kitware.com>2008-03-07 15:30:35 -0500
commit5233b75a777b0f3379408291e6f32b0eb15c2f54 (patch)
tree538d48ac384f0129059e3e1c20f2a46e9a3949cf /Source/cmAddCustomTargetCommand.cxx
parentfcce2f3b61ca5a3484d41aa804dc09b39f16f8cf (diff)
downloadcmake-5233b75a777b0f3379408291e6f32b0eb15c2f54.tar.gz
ENH: Improve handling of old-style compatibility.
- Remove CMP_0001 (no slash in target name) and restore old CMAKE_BACKWARDS_COMPATIBILITY check for it - Replace all checks of CMAKE_BACKWARDS_COMPATIBILITY with cmLocalGenerator::NeedBackwardsCompatibility calls - Create new CMP_0001 to determine whether or not CMAKE_BACKWARDS_COMPATIBILITY is used. (old = use, new = ignore) - Show CMAKE_BACKWARDS_COMPATIBILITY in cache only when CMP_0001 is set to OLD or WARN - Update documentation of cmake_policy and cmake_minimum_required to indicate their relationship and the 2.4 version boundary - When no cmake policy version is set in top level makefile implicitly call cmake_policy(VERSION 2.4) which restores CMAKE_BACKWARDS_COMPATIBILITY and other 2.4 compatibility - Fix tests MakeClean and Preprocess to call cmake_policy(VERSION 2.6) because they depend on new policies
Diffstat (limited to 'Source/cmAddCustomTargetCommand.cxx')
-rw-r--r--Source/cmAddCustomTargetCommand.cxx57
1 files changed, 19 insertions, 38 deletions
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 07f00ea74c..9a3b4b396c 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -21,18 +21,6 @@ bool cmAddCustomTargetCommand
::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- // This enum must be before an enum is used in a switch statment.
- // If not there is an ICE on the itanium version of gcc we are running
- // on dash8
-
- // Keep track of parser state.
- enum tdoing {
- doing_command,
- doing_depends,
- doing_working_directory,
- doing_comment,
- doing_verbatim
- };
if(args.size() < 1 )
{
this->SetError("called with incorrect number of arguments");
@@ -41,34 +29,20 @@ bool cmAddCustomTargetCommand
// Check the target name.
if(args[0].find_first_of("/\\") != args[0].npos)
- {
- // slashes are not allowed anymore in taret names CMP_0001
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP_0001))
{
- case cmPolicies::WARN:
- this->Makefile->IssueWarning(
- this->Makefile->GetPolicies()->GetPolicyWarning
- (cmPolicies::CMP_0001));
- case cmPolicies::OLD:
-// if (this->Makefile->IsBWCompatibilityLessThan(2,2))
-// {
-// break;
-// }
- case cmPolicies::NEW:
- this->SetError("You included a / or \\ in your target name and "
- "this is not allowed according to policy CMP_0001. Run "
- "cmake --help-policy CMP_0001 for more information.");
- return false;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- this->Makefile->IssueError(
- this->Makefile->GetPolicies()->GetRequiredPolicyError
- (cmPolicies::CMP_0001).c_str()
- );
- return false;
+ if(!this->Makefile->NeedBackwardsCompatibility(2,2))
+ {
+ cmOStringStream e;
+ e << "called with invalid target name \"" << args[0]
+ << "\". Target names may not contain a slash. "
+ << "Use ADD_CUSTOM_COMMAND to generate files. "
+ << "Set CMAKE_BACKWARDS_COMPATIBILITY to 2.2 "
+ << "or lower to skip this check.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
}
- }
-
+
// Accumulate one command line at a time.
cmCustomCommandLine currentLine;
@@ -83,6 +57,13 @@ bool cmAddCustomTargetCommand
const char* comment = 0;
// Keep track of parser state.
+ enum tdoing {
+ doing_command,
+ doing_depends,
+ doing_working_directory,
+ doing_comment,
+ doing_verbatim
+ };
tdoing doing = doing_command;
// Look for the ALL option.