summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomTargetCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2008-03-01 20:20:35 (GMT)
committerKen Martin <ken.martin@kitware.com>2008-03-01 20:20:35 (GMT)
commitd49ef18f8a9ebe4e512d67d3fb88958c655beb69 (patch)
treea40a7a4649f9a7137579c6c22be29846f97d72c3 /Source/cmAddCustomTargetCommand.cxx
parent32ca01bef0fe4218319d9c9fd02ea11336f5e134 (diff)
downloadCMake-d49ef18f8a9ebe4e512d67d3fb88958c655beb69.zip
CMake-d49ef18f8a9ebe4e512d67d3fb88958c655beb69.tar.gz
CMake-d49ef18f8a9ebe4e512d67d3fb88958c655beb69.tar.bz2
ENH: add first cut and policies still need to add the doc support
Diffstat (limited to 'Source/cmAddCustomTargetCommand.cxx')
-rw-r--r--Source/cmAddCustomTargetCommand.cxx44
1 files changed, 25 insertions, 19 deletions
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 06998c6..aaa2af0 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -28,27 +28,33 @@ 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))
{
- int major = 0;
- int minor = 0;
- if(const char* versionValue =
- this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"))
- {
- sscanf(versionValue, "%d.%d", &major, &minor);
- }
- if(!major || major > 3 || (major == 2 && minor > 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;
- }
+ case cmPolicies::WARN:
+ cmSystemTools::Message(
+ this->Makefile->GetPolicies()->GetPolicyWarning
+ (cmPolicies::CMP_0001).c_str(),"Warning");
+ 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;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ this->SetError(
+ this->Makefile->GetPolicies()->GetRequiredPolicyError
+ (cmPolicies::CMP_0001).c_str());
+ return false;
}
-
+ }
+
// Accumulate one command line at a time.
cmCustomCommandLine currentLine;