[cmake-commits] king committed cmTarget.cxx 1.167 1.168

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Dec 17 10:12:24 EST 2007


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

Modified Files:
	cmTarget.cxx 
Log Message:
ENH: Added SOURCES property to targets.  This is based on patch from issues #6137.


Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- cmTarget.cxx	21 Nov 2007 13:59:43 -0000	1.167
+++ cmTarget.cxx	17 Dec 2007 15:12:22 -0000	1.168
@@ -296,6 +296,13 @@
      "An internal property used by some generators to record the name of "
      "project or dsp file associated with this target.");
 
+  cm->DefineProperty
+    ("SOURCES", cmProperty::TARGET,
+     "Source names specified for a target.",
+     "Read-only list of sources specified for a target.  "
+     "The names returned are suitable for passing to the "
+     "set_source_files_properties command.");
+
 #if 0
   cm->DefineProperty
     ("OBJECT_FILES", cmProperty::TARGET,
@@ -1524,6 +1531,33 @@
     return this->IsImported()?"TRUE":"FALSE";
     }
 
+  if(!strcmp(prop,"SOURCES"))
+    {
+    cmOStringStream ss;
+    const char* sep = "";
+    for(std::vector<cmSourceFile*>::const_iterator
+          i = this->SourceFiles.begin();
+        i != this->SourceFiles.end(); ++i)
+      {
+      // Separate from the previous list entries.
+      ss << sep;
+      sep = ";";
+
+      // Construct what is known about this source file location.
+      cmSourceFileLocation const& location = (*i)->GetLocation();
+      std::string sname = location.GetDirectory();
+      if(!sname.empty())
+        {
+        sname += "/";
+        }
+      sname += location.GetName();
+
+      // Append this list entry.
+      ss << sname;
+      }
+    this->SetProperty("SOURCES", ss.str().c_str());
+    }
+
   // the type property returns what type the target is
   if (!strcmp(prop,"TYPE"))
     {



More information about the Cmake-commits mailing list