[cmake-commits] king committed cmAddCustomTargetCommand.cxx 1.21 1.22

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Sep 13 11:39:51 EDT 2006


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv5094

Modified Files:
	cmAddCustomTargetCommand.cxx 
Log Message:
ENH: Added diagnosis of bad target names.


Index: cmAddCustomTargetCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomTargetCommand.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmAddCustomTargetCommand.cxx	15 Mar 2006 16:01:58 -0000	1.21
+++ cmAddCustomTargetCommand.cxx	13 Sep 2006 15:39:46 -0000	1.22
@@ -26,6 +26,29 @@
     return false;
     }
 
+  // Check the target name.
+  if(args[0].find_first_of("/\\") != args[0].npos)
+    {
+    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;
+      }
+    }
+
   // Accumulate one command line at a time.
   cmCustomCommandLine currentLine;
 



More information about the Cmake-commits mailing list