[cmake-commits] martink committed cmAuxSourceDirectoryCommand.cxx 1.22 1.23 cmCPluginAPI.cxx 1.34 1.35 cmCreateTestSourceList.cxx 1.41 1.42 cmFLTKWrapUICommand.cxx 1.32 1.33 cmMakefile.cxx 1.370 1.371 cmPropertyMap.cxx 1.3 1.4 cmSourceFile.cxx 1.34 1.35 cmSourceFile.h 1.18 1.19

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Dec 13 12:20:01 EST 2006


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

Modified Files:
	cmAuxSourceDirectoryCommand.cxx cmCPluginAPI.cxx 
	cmCreateTestSourceList.cxx cmFLTKWrapUICommand.cxx 
	cmMakefile.cxx cmPropertyMap.cxx cmSourceFile.cxx 
	cmSourceFile.h 
Log Message:
ENH: allow source file properties to chain to Directories and up


Index: cmFLTKWrapUICommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFLTKWrapUICommand.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmFLTKWrapUICommand.cxx	7 Dec 2006 14:44:45 -0000	1.32
+++ cmFLTKWrapUICommand.cxx	13 Dec 2006 17:19:58 -0000	1.33
@@ -54,8 +54,7 @@
     if (!curr || !curr->GetPropertyAsBool("WRAP_EXCLUDE"))
       {
       cmSourceFile header_file;
-      header_file.GetProperties().SetCMakeInstance
-        (this->Makefile->GetCMakeInstance());
+      header_file.SetMakefile(this->Makefile);
       std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*i);
       const bool headerFileOnly = true;
       header_file.SetName(srcName.c_str(), 

Index: cmAuxSourceDirectoryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAuxSourceDirectoryCommand.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cmAuxSourceDirectoryCommand.cxx	7 Dec 2006 14:44:45 -0000	1.22
+++ cmAuxSourceDirectoryCommand.cxx	13 Dec 2006 17:19:58 -0000	1.23
@@ -69,8 +69,7 @@
           // add the file as a class file so 
           // depends can be done
           cmSourceFile cmfile;
-          cmfile.GetProperties().SetCMakeInstance
-            (this->Makefile->GetCMakeInstance());
+          cmfile.SetMakefile(this->Makefile);
           cmfile.SetName(fullname.c_str(), 
                          this->Makefile->GetCurrentDirectory(),
                          this->Makefile->GetSourceExtensions(),

Index: cmSourceFile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSourceFile.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmSourceFile.cxx	7 Dec 2006 14:44:45 -0000	1.34
+++ cmSourceFile.cxx	13 Dec 2006 17:19:59 -0000	1.35
@@ -18,6 +18,7 @@
 #include "cmSystemTools.h"
 
 #include "cmake.h"
+#include "cmMakefile.h"
 
 // Set the name of the class and the full path to the file.
 // The class must be found in dir and end in name.cxx, name.txx, 
@@ -193,8 +194,14 @@
     }
 
   bool chain = false;
-  return this->Properties.GetPropertyValue(prop,cmProperty::SOURCE_FILE, 
-                                           chain);
+  const char *retVal = 
+    this->Properties.GetPropertyValue(prop, cmProperty::SOURCE_FILE, chain);
+  if (chain)
+    {
+    return this->Makefile->GetProperty(prop,cmProperty::SOURCE_FILE);
+    }
+
+  return retVal;    
 }
 
 bool cmSourceFile::GetPropertyAsBool(const char* prop) const
@@ -223,9 +230,20 @@
 
 cmSourceFile::cmSourceFile()
 {
+  this->Makefile = 0;
   this->CustomCommand = 0; 
 }
 
+//----------------------------------------------------------------------------
+void cmSourceFile::SetMakefile(cmMakefile* mf)
+{
+  // Set our makefile.
+  this->Makefile = mf;
+
+  // set the cmake instance of the properties
+  this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
+}
+
 // define properties
 void cmSourceFile::DefineProperties(cmake *cm)
 {

Index: cmCreateTestSourceList.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCreateTestSourceList.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- cmCreateTestSourceList.cxx	7 Dec 2006 14:44:45 -0000	1.41
+++ cmCreateTestSourceList.cxx	13 Dec 2006 17:19:58 -0000	1.42
@@ -172,7 +172,7 @@
 
   // Create the source list
   cmSourceFile cfile;
-  cfile.GetProperties().SetCMakeInstance(this->Makefile->GetCMakeInstance());
+  cfile.SetMakefile(this->Makefile);
   std::string sourceListValue;
 
   cfile.SetProperty("ABSTRACT","0");
@@ -186,8 +186,7 @@
   for(i = testsBegin; i != tests.end(); ++i)
     {
     cmSourceFile icfile;
-    icfile.GetProperties().
-      SetCMakeInstance(this->Makefile->GetCMakeInstance());
+    icfile.SetMakefile(this->Makefile);
     icfile.SetProperty("ABSTRACT","0");
     icfile.SetName(i->c_str(),
                   this->Makefile->GetCurrentDirectory(),

Index: cmCPluginAPI.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCPluginAPI.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmCPluginAPI.cxx	7 Dec 2006 14:51:28 -0000	1.34
+++ cmCPluginAPI.cxx	13 Dec 2006 17:19:58 -0000	1.35
@@ -511,7 +511,7 @@
 {
   cmMakefile *mf = static_cast<cmMakefile *>(arg);
   cmSourceFile *sf = new cmSourceFile;
-  sf->GetProperties().SetCMakeInstance(mf->GetCMakeInstance());
+  sf->SetMakefile(mf);
   return (void *)sf;
 }
 

Index: cmSourceFile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSourceFile.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cmSourceFile.h	7 Dec 2006 14:44:45 -0000	1.18
+++ cmSourceFile.h	13 Dec 2006 17:19:59 -0000	1.19
@@ -21,6 +21,7 @@
 #include "cmPropertyMap.h"
 
 class cmake;
+class cmMakefile;
 
 /** \class cmSourceFile
  * \brief Represent a class loaded from a makefile.
@@ -114,6 +115,10 @@
   // Define the properties
   static void DefineProperties(cmake *cm);
 
+  ///! Set the cmMakefile that owns this target
+  void SetMakefile(cmMakefile *mf);
+  cmMakefile *GetMakefile() { return this->Makefile;};
+
 private:
   cmPropertyMap Properties;
   cmCustomCommand *CustomCommand;
@@ -122,6 +127,10 @@
   std::string SourceExtension;
   std::vector<std::string> Depends;
   std::string SourceNameWithoutLastExtension;
+
+  // The cmMakefile instance that owns this source file.  This should
+  // always be set.
+  cmMakefile* Makefile;
 };
 
 #endif

Index: cmPropertyMap.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmPropertyMap.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cmPropertyMap.cxx	7 Dec 2006 15:33:35 -0000	1.3
+++ cmPropertyMap.cxx	13 Dec 2006 17:19:59 -0000	1.4
@@ -19,7 +19,7 @@
 #include "cmake.h"
 
 // define STRICT to get checking of all set and get property calls
-//#define STRICT 
+#define STRICT 
 
 cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name)
 {

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.370
retrieving revision 1.371
diff -u -d -r1.370 -r1.371
--- cmMakefile.cxx	7 Dec 2006 14:44:45 -0000	1.370
+++ cmMakefile.cxx	13 Dec 2006 17:19:58 -0000	1.371
@@ -2281,7 +2281,7 @@
 
   // we must create one
   cmSourceFile file; 
-  file.GetProperties().SetCMakeInstance(this->GetCMakeInstance());
+  file.SetMakefile(this);
   std::string path = cmSystemTools::GetFilenamePath(src);
   if(generated)
     {
@@ -2329,12 +2329,15 @@
   this->AddSource(file);
   src = file.GetFullPath();
   ret = this->GetSource(src.c_str());
-  ret->GetProperties().SetCMakeInstance(this->GetCMakeInstance());
   if (!ret)
     {
     cmSystemTools::Error(
       "CMake failed to properly look up cmSourceFile: ", sourceName);
     }
+  else
+    {
+    ret->SetMakefile(this);
+    }
   return ret;
 }
 



More information about the Cmake-commits mailing list