[cmake-commits] alex committed cmGlobalGenerator.cxx 1.173.4.1 1.173.4.2 cmGlobalGenerator.h 1.73 1.73.4.1 cmGlobalVisualStudio6Generator.cxx 1.67.4.1 1.67.4.2 cmGlobalVisualStudio7Generator.cxx 1.85.4.1 1.85.4.2 cmGlobalXCodeGenerator.cxx 1.142.4.2 1.142.4.3 cmLocalGenerator.cxx 1.212.4.1 1.212.4.2 cmLocalGenerator.h 1.78.4.1 1.78.4.2 cmLocalUnixMakefileGenerator3.cxx 1.204.4.2 1.204.4.3 cmLocalVisualStudio6Generator.cxx 1.120.4.3 1.120.4.4 cmLocalVisualStudio7Generator.cxx 1.187.2.2 1.187.2.3

cmake-commits at cmake.org cmake-commits at cmake.org
Tue May 8 14:47:36 EDT 2007


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

Modified Files:
      Tag: CMake-ACC-TargetUsedAsCommand
	cmGlobalGenerator.cxx cmGlobalGenerator.h 
	cmGlobalVisualStudio6Generator.cxx 
	cmGlobalVisualStudio7Generator.cxx cmGlobalXCodeGenerator.cxx 
	cmLocalGenerator.cxx cmLocalGenerator.h 
	cmLocalUnixMakefileGenerator3.cxx 
	cmLocalVisualStudio6Generator.cxx 
	cmLocalVisualStudio7Generator.cxx 
Log Message:

ENH: move TraceVSDependencies() from every generator to the end of
GlobalGenerator::Configure(), removes some code duplication and makes it
easier to add support for "importing" targets

Alex


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.187.2.2
retrieving revision 1.187.2.3
diff -u -d -r1.187.2.2 -r1.187.2.3
--- cmLocalVisualStudio7Generator.cxx	4 May 2007 21:09:33 -0000	1.187.2.2
+++ cmLocalVisualStudio7Generator.cxx	8 May 2007 18:47:34 -0000	1.187.2.3
@@ -125,20 +125,10 @@
       this->AddVCProjBuildRule(l->second);
       }
 
-    // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
-    // so don't build a projectfile for it
-    if ((l->second.GetType() != cmTarget::INSTALL_FILES)
-        && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
-        && (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
-      {
-      cmTarget& target = l->second;
-      target.TraceVSDependencies(target.GetName(), this->Makefile);
-      }
-    }
-
   for(cmTargets::iterator l = tgts.begin();
       l != tgts.end(); l++)
     {
+      // TODO ignore ABSTRACT targets
     // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
     // so don't build a projectfile for it
     if ((l->second.GetType() != cmTarget::INSTALL_FILES)

Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.78.4.1
retrieving revision 1.78.4.2
diff -u -d -r1.78.4.1 -r1.78.4.2
--- cmLocalGenerator.h	4 May 2007 20:43:29 -0000	1.78.4.1
+++ cmLocalGenerator.h	8 May 2007 18:47:34 -0000	1.78.4.2
@@ -39,10 +39,13 @@
   cmLocalGenerator();
   virtual ~cmLocalGenerator();
   
+  virtual void TraceDependencies();
+  
+  
   /**
    * Generate the makefile for this directory. 
    */
-  virtual void Generate() {};
+  virtual void Generate() {}
 
   /**
    * Process the CMakeLists files for this directory to fill in the
@@ -303,6 +306,8 @@
   bool IgnoreLibPrefix;
   bool Configured;
   bool EmitUniversalBinaryFlags;
+  // A type flag is not nice. It's used only in TraceDependencies().
+  bool IsMakefileGenerator;
   // Hack for ExpandRuleVariable until object-oriented version is
   // committed.
   std::string TargetImplib;

Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.212.4.1
retrieving revision 1.212.4.2
diff -u -d -r1.212.4.1 -r1.212.4.2
--- cmLocalGenerator.cxx	4 May 2007 20:43:29 -0000	1.212.4.1
+++ cmLocalGenerator.cxx	8 May 2007 18:47:34 -0000	1.212.4.2
@@ -52,6 +52,7 @@
   this->UseRelativePaths = false;
   this->Configured = false;
   this->EmitUniversalBinaryFlags = true;
+  this->IsMakefileGenerator = false;
   this->RelativePathsConfigured = false;
   this->PathConversionsSetup = false;
 }
@@ -135,6 +136,30 @@
   this->Makefile->ConfigureFinalPass();
 }
 
+void cmLocalGenerator::TraceDependencies()
+{
+  // Generate the rule files for each target.
+  cmTargets& targets = this->Makefile->GetTargets();
+  for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+    {
+    // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
+    // so don't build a projectfile for it
+    if ((t->second.GetType() != cmTarget::INSTALL_FILES)
+        && (t->second.GetType() != cmTarget::INSTALL_PROGRAMS)
+        && (t->second.GetType() != cmTarget::INSTALL_DIRECTORY)
+        && (strncmp(t->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
+        && (t->second.GetPropertyAsBool("IMPORTED") == false))
+      {
+      std::string projectFilename;
+      if (this->IsMakefileGenerator == false)  // only use of this variable
+        {
+        projectFilename=t->second.GetName();
+        }
+      t->second.TraceVSDependencies(projectFilename, this->Makefile);
+      }
+    }
+}
+
 void cmLocalGenerator::GenerateTestFiles()
 {
   if ( !this->Makefile->IsOn("CMAKE_TESTING_ENABLED") )
@@ -696,6 +721,7 @@
   for(cmTargets::iterator l = tgts.begin(); 
       l != tgts.end(); l++)
     {
+      // TODO ignore ABSTRACT targets
     cmTarget& target = l->second;
     switch(target.GetType())
       { 

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.142.4.2
retrieving revision 1.142.4.3
diff -u -d -r1.142.4.2 -r1.142.4.3
--- cmGlobalXCodeGenerator.cxx	8 May 2007 18:28:31 -0000	1.142.4.2
+++ cmGlobalXCodeGenerator.cxx	8 May 2007 18:47:34 -0000	1.142.4.3
@@ -583,7 +583,7 @@
       {
       targets.push_back(this->CreateUtilityTarget(cmtarget));
       }
-
+    // TODO ignore ABSTRACT targets
     if(cmtarget.GetType() == cmTarget::UTILITY ||
        cmtarget.GetType() == cmTarget::GLOBAL_TARGET ||
        cmtarget.GetType() == cmTarget::INSTALL_FILES ||
@@ -2415,20 +2415,6 @@
     cmMakefile* mf = (*g)->GetMakefile();
     std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
     cmTargets &tgts = mf->GetTargets();
-  // Call TraceVSDependencies on all targets
-  for(cmTargets::iterator l = tgts.begin(); 
-      l != tgts.end(); l++)
-    {
-    // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
-    // so don't build a projectfile for it
-    if ((l->second.GetType() != cmTarget::INSTALL_FILES)
-        && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
-        && (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
-      {
-      cmTarget& target = l->second;
-      target.TraceVSDependencies(target.GetName(), mf);
-      }
-    }
   // now for all custom commands that are not used directly in a 
   // target, add them to all targets in the current directory or
   // makefile

Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.73
retrieving revision 1.73.4.1
diff -u -d -r1.73 -r1.73.4.1
--- cmGlobalGenerator.h	12 Apr 2007 19:46:06 -0000	1.73
+++ cmGlobalGenerator.h	8 May 2007 18:47:34 -0000	1.73.4.1
@@ -202,6 +202,7 @@
   void FillProjectMap();
   bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
   void FillProjectToTargetMap();
+  void TraceDependencies();
   void CreateDefaultGlobalTargets(cmTargets* targets);
   cmTarget CreateGlobalTarget(const char* name, const char* message,
     const cmCustomCommandLines* commandLines,

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.173.4.1
retrieving revision 1.173.4.2
diff -u -d -r1.173.4.1 -r1.173.4.2
--- cmGlobalGenerator.cxx	8 May 2007 18:28:31 -0000	1.173.4.1
+++ cmGlobalGenerator.cxx	8 May 2007 18:47:34 -0000	1.173.4.2
@@ -722,7 +722,9 @@
   // This will make sure that targets have all the 
   // targets they depend on as part of the build.
   this->FillProjectToTargetMap();
-
+  // now trace all dependencies
+  this->TraceDependencies();
+  
   if ( !this->CMakeInstance->GetScriptMode() )
     {
     this->CMakeInstance->UpdateProgress("Configuring done", -1);
@@ -1041,6 +1043,13 @@
   return "None";
 }
 
+void cmGlobalGenerator::TraceDependencies()
+{ 
+  for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
+    {
+    this->LocalGenerators[i]->TraceDependencies();
+    }
+}
 
 void cmGlobalGenerator::FillProjectMap()
 { 

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.120.4.3
retrieving revision 1.120.4.4
diff -u -d -r1.120.4.3 -r1.120.4.4
--- cmLocalVisualStudio6Generator.cxx	7 May 2007 12:48:12 -0000	1.120.4.3
+++ cmLocalVisualStudio6Generator.cxx	8 May 2007 18:47:34 -0000	1.120.4.4
@@ -116,22 +116,14 @@
       {
       this->AddDSPBuildRule(l->second);
       }
-
-    // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
-    // so don't build a projectfile for it
-    if ((l->second.GetType() != cmTarget::INSTALL_FILES)
-        && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
-        && (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
-      {
-      cmTarget& target = l->second;
-      target.TraceVSDependencies(target.GetName(), this->Makefile);
-      }
     }
 
   // build any targets
   for(cmTargets::iterator l = tgts.begin(); 
       l != tgts.end(); l++)
     {
+      
+      // TODO ignore ABSTRACT targets
     switch(l->second.GetType())
       {
       case cmTarget::STATIC_LIBRARY:

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.204.4.2
retrieving revision 1.204.4.3
diff -u -d -r1.204.4.2 -r1.204.4.3
--- cmLocalUnixMakefileGenerator3.cxx	7 May 2007 18:42:13 -0000	1.204.4.2
+++ cmLocalUnixMakefileGenerator3.cxx	8 May 2007 18:47:34 -0000	1.204.4.3
@@ -54,6 +54,7 @@
   this->NativeEchoCommand = "@echo ";
   this->NativeEchoWindows = true;
   this->MakeCommandEscapeTargetTwice = false;
+  this->IsMakefileGenerator = true;
 }
 
 //----------------------------------------------------------------------------
@@ -112,7 +113,7 @@
     if (tg)
       {
       this->TargetGenerators.push_back(tg);
-      t->second.TraceVSDependencies(empty, this->Makefile);
+//      t->second.TraceVSDependencies(empty, this->Makefile);
       tg->WriteRuleFiles();
       }
     }
@@ -336,6 +337,7 @@
   // on the target
   cmTargets& targets = this->Makefile->GetTargets();
   std::string localName;
+  // TODO ignore ABSTRACT targets
   for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
     {
     if((t->second.GetType() == cmTarget::EXECUTABLE) ||

Index: cmGlobalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio6Generator.cxx,v
retrieving revision 1.67.4.1
retrieving revision 1.67.4.2
diff -u -d -r1.67.4.1 -r1.67.4.2
--- cmGlobalVisualStudio6Generator.cxx	8 May 2007 18:28:30 -0000	1.67.4.1
+++ cmGlobalVisualStudio6Generator.cxx	8 May 2007 18:47:34 -0000	1.67.4.2
@@ -256,6 +256,7 @@
         }
       else 
         {
+        // TODO ignore ABSTRACT targets
         if ((l->second.GetType() != cmTarget::INSTALL_FILES)
             && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
           {

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.85.4.1
retrieving revision 1.85.4.2
diff -u -d -r1.85.4.1 -r1.85.4.2
--- cmGlobalVisualStudio7Generator.cxx	8 May 2007 18:28:31 -0000	1.85.4.1
+++ cmGlobalVisualStudio7Generator.cxx	8 May 2007 18:47:34 -0000	1.85.4.2
@@ -341,6 +341,7 @@
         }
       else 
         {
+        // TODO ignore ABSTRACT targets
         if ((l->second.GetType() != cmTarget::INSTALL_FILES)
             && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
           {



More information about the Cmake-commits mailing list