[cmake-commits] alex committed cmAddDependenciesCommand.cxx 1.14 1.14.6.1 cmAddExecutableCommand.cxx 1.29.6.1 1.29.6.2 cmGetTargetPropertyCommand.cxx 1.7 1.7.8.1 cmGlobalGenerator.cxx 1.174 1.174.2.1 cmGlobalGenerator.h 1.74 1.74.2.1 cmGlobalUnixMakefileGenerator3.cxx 1.106.2.1 1.106.2.2 cmGlobalVisualStudio6Generator.cxx 1.68 1.68.2.1 cmGlobalVisualStudio71Generator.cxx 1.39 1.39.6.1 cmGlobalVisualStudio7Generator.cxx 1.86 1.86.2.1 cmGlobalVisualStudio8Generator.cxx 1.19 1.19.6.1 cmGlobalVisualStudioGenerator.cxx 1.3 1.3.6.1 cmGlobalXCodeGenerator.cxx 1.145 1.145.2.1 cmIncludeExternalMSProjectCommand.cxx 1.18.6.1 1.18.6.2 cmInstallCommand.cxx 1.20 1.20.6.1 cmInstallFilesCommand.cxx 1.24 1.24.6.1 cmInstallTargetGenerator.cxx 1.28 1.28.6.1 cmLocalGenerator.cxx 1.215 1.215.2.1 cmLocalGenerator.h 1.79 1.79.2.1 cmLocalUnixMakefileGenerator3.cxx 1.205.2.1 1.205.2.2 cmLocalVisualStudio6Generator.cxx 1.121 1.121.2.1 cmLocalVisualStudio6Generator.h 1.17 1.17.2.1 cmLocalVisualStudio7Generator.cxx 1.188 1.188.2.1 cmLocalVisualStudio7Generator.h 1.38 1.38.2.1 cmMakefile.cxx 1.386.2.1 1.386.2.2 cmMakefile.h 1.200.6.1 1.200.6.2 cmMakefileTargetGenerator.cxx 1.62.4.1 1.62.4.2 cmSetTargetPropertiesCommand.cxx 1.6 1.6.6.1 cmTarget.cxx 1.137.2.1 1.137.2.2 cmTarget.h 1.82.2.1 1.82.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Thu May 10 11:41:51 EDT 2007


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

Modified Files:
      Tag: CMake-ImportTargets
	cmAddDependenciesCommand.cxx cmAddExecutableCommand.cxx 
	cmGetTargetPropertyCommand.cxx cmGlobalGenerator.cxx 
	cmGlobalGenerator.h cmGlobalUnixMakefileGenerator3.cxx 
	cmGlobalVisualStudio6Generator.cxx 
	cmGlobalVisualStudio71Generator.cxx 
	cmGlobalVisualStudio7Generator.cxx 
	cmGlobalVisualStudio8Generator.cxx 
	cmGlobalVisualStudioGenerator.cxx cmGlobalXCodeGenerator.cxx 
	cmIncludeExternalMSProjectCommand.cxx cmInstallCommand.cxx 
	cmInstallFilesCommand.cxx cmInstallTargetGenerator.cxx 
	cmLocalGenerator.cxx cmLocalGenerator.h 
	cmLocalUnixMakefileGenerator3.cxx 
	cmLocalVisualStudio6Generator.cxx 
	cmLocalVisualStudio6Generator.h 
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h cmMakefile.cxx cmMakefile.h 
	cmMakefileTargetGenerator.cxx cmSetTargetPropertiesCommand.cxx 
	cmTarget.cxx cmTarget.h 
Log Message:

ENH: first try at "importing" targets (from other build trees), now done
using a separate container for the imported targets
-as in HEAD: move TraceVSDependencies() to one central place, GlobalGenerator::Generate()

Alex


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.188
retrieving revision 1.188.2.1
diff -u -d -r1.188 -r1.188.2.1
--- cmLocalVisualStudio7Generator.cxx	9 May 2007 12:25:45 -0000	1.188
+++ cmLocalVisualStudio7Generator.cxx	10 May 2007 15:41:49 -0000	1.188.2.1
@@ -42,8 +42,7 @@
 {
 }
 
-
-void cmLocalVisualStudio7Generator::Generate()
+void cmLocalVisualStudio7Generator::AddHelperCommands()
 {
   std::set<cmStdString> lang;
   lang.insert("C");
@@ -53,6 +52,10 @@
   lang.insert("DEF");
   this->CreateCustomTargetsAndCommands(lang);
   this->FixGlobalTargets();
+}
+
+void cmLocalVisualStudio7Generator::Generate()
+{
   this->OutputVCProjFile();
 }
 
@@ -79,7 +82,7 @@
       force += "/";
       force += tgt.GetName();
       force += "_force";
-      this->Makefile->AddCustomCommandToOutput(force.c_str(), no_depends,
+      this->Makefile->AddCustomCommandToOutput(force.c_str(), no_depends,  // is now again before TraceVSDep
                                                no_main_dependency,
                                                force_commands, " ", 0, true);
       if(cmSourceFile* file =
@@ -213,7 +216,7 @@
   cmCustomCommandLines commandLines;
   commandLines.push_back(commandLine);
   const char* no_working_directory = 0;
-  this->Makefile->AddCustomCommandToOutput(dspname.c_str(), listFiles,
+  this->Makefile->AddCustomCommandToOutput(dspname.c_str(), listFiles,  // may be broken, was directly before TraceVSDep
                                            makefileIn.c_str(), commandLines,
                                            comment.c_str(),
                                            no_working_directory, true);

Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -u -d -r1.38 -r1.38.2.1
--- cmLocalVisualStudio7Generator.h	9 May 2007 12:25:45 -0000	1.38
+++ cmLocalVisualStudio7Generator.h	10 May 2007 15:41:49 -0000	1.38.2.1
@@ -41,7 +41,9 @@
   cmLocalVisualStudio7Generator();
 
   virtual ~cmLocalVisualStudio7Generator();
-  
+
+  virtual void AddHelperCommands();
+
   /**
    * Generate the makefile for this directory. 
    */

Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.74
retrieving revision 1.74.2.1
diff -u -d -r1.74 -r1.74.2.1
--- cmGlobalGenerator.h	9 May 2007 12:25:45 -0000	1.74
+++ cmGlobalGenerator.h	10 May 2007 15:41:48 -0000	1.74.2.1
@@ -157,7 +157,7 @@
   void FindMakeProgram(cmMakefile*);
 
   ///! Find a target by name by searching the local generators.
-  cmTarget* FindTarget(const char* project, const char* name);
+  cmTarget* FindTarget(const char* project, const char* name, bool useImportedTargets);
 
   /** If check to see if the target is linked to by any other
       target in the project */
@@ -177,9 +177,8 @@
       configuration.  This is valid during generation only.  */
   cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; }
 
-  void AddTarget(cmTargets::value_type &v) { 
-    this->TotalTargets[v.first] = &v.second;};
-  
+  void AddTarget(cmTargets::value_type &v);
+
   /** Support for multiple custom command outputs.  */
   virtual void CheckMultipleOutputs(cmMakefile* mf, bool verbose);
 
@@ -202,8 +201,6 @@
   void FillProjectMap();
   bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen);
   void FillProjectToTargetMap();
-  // Calls TraceVSDependencies() on all targets
-  void TraceDependencies();
   void CreateDefaultGlobalTargets(cmTargets* targets);
   cmTarget CreateGlobalTarget(const char* name, const char* message,
     const cmCustomCommandLines* commandLines,
@@ -241,6 +238,7 @@
 
   // this is used to improve performance 
   std::map<cmStdString,cmTarget *> TotalTargets;
+  std::map<cmStdString,cmTarget *> ImportedTotalTargets;
   
   std::map<cmStdString, std::vector<cmTarget *> > TargetDependencies;
 };

Index: cmGlobalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalUnixMakefileGenerator3.cxx,v
retrieving revision 1.106.2.1
retrieving revision 1.106.2.2
diff -u -d -r1.106.2.1 -r1.106.2.2
--- cmGlobalUnixMakefileGenerator3.cxx	9 May 2007 15:44:58 -0000	1.106.2.1
+++ cmGlobalUnixMakefileGenerator3.cxx	10 May 2007 15:41:48 -0000	1.106.2.2
@@ -642,8 +642,6 @@
       if(t->second.GetName() &&
          strlen(t->second.GetName()) &&
          emitted.insert(t->second.GetName()).second &&
-         // don't emit rules for imported targets
-         (t->second.GetPropertyAsBool("IMPORTED") == false) &&
          // Handle user targets here.  Global targets are handled in
          // the local generator on a per-directory basis.
          ((t->second.GetType() == cmTarget::EXECUTABLE) ||
@@ -716,7 +714,6 @@
     {
     if (t->second.GetName()
      && strlen(t->second.GetName())
-     && (t->second.GetPropertyAsBool("IMPORTED") == false)
      && ((t->second.GetType() == cmTarget::EXECUTABLE)
         || (t->second.GetType() == cmTarget::STATIC_LIBRARY)
         || (t->second.GetType() == cmTarget::SHARED_LIBRARY)
@@ -1060,12 +1057,12 @@
   // first check the same dir as the current target
   lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
     (target.GetMakefile()->GetLocalGenerator());
-  result = target.GetMakefile()->FindTarget(name);
+  result = target.GetMakefile()->FindTarget(name, false);
   
   // search each local generator until a match is found
   if (!result)
     {
-    result = this->FindTarget(0,name);
+    result = this->FindTarget(0, name, false);
     if (result)
       {
       lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.174
retrieving revision 1.174.2.1
diff -u -d -r1.174 -r1.174.2.1
--- cmGlobalGenerator.cxx	9 May 2007 12:25:45 -0000	1.174
+++ cmGlobalGenerator.cxx	10 May 2007 15:41:48 -0000	1.174.2.1
@@ -625,6 +625,7 @@
   this->LocalGenerators.clear();
   this->TargetDependencies.clear();
   this->TotalTargets.clear();
+  this->ImportedTotalTargets.clear();
   this->ProjectToTargetMap.clear();
   this->ProjectMap.clear();
 
@@ -715,27 +716,27 @@
                          "Please set the following variables:\n",
                          notFoundVars.c_str());
     }
-  // at this point this->LocalGenerators has been filled,
-  // so create the map from project name to vector of local generators
-  this->FillProjectMap();
-  // now create project to target map 
-  // 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);
     }
 }
 
+
 void cmGlobalGenerator::Generate()
 {
-  // For each existing cmLocalGenerator
-  unsigned int i;
+  // at this point this->LocalGenerators has been filled,
+  // so create the map from project name to vector of local generators
+  this->FillProjectMap();
+  // now create project to target map 
+  // This will make sure that targets have all the 
+  // targets they depend on as part of the build.
+  this->FillProjectToTargetMap();
 
+  // For each existing cmLocalGenerator...
+  unsigned int i;
+ 
   // Consolidate global targets
   cmTargets globalTargets;
   this->CreateDefaultGlobalTargets(&globalTargets);
@@ -770,6 +771,19 @@
     this->LocalGenerators[i]->GenerateTargetManifest(this->TargetManifest);
     }
 
+  // Add generator specific helper commands
+  for (i = 0; i < this->LocalGenerators.size(); ++i)
+    {
+    this->LocalGenerators[i]->AddHelperCommands();
+    }
+
+  // Trace the dependencies, after that no custom commands should be added
+  // because their dependencies might not be handled correctly
+  for (i = 0; i < this->LocalGenerators.size(); ++i)
+    {
+    this->LocalGenerators[i]->TraceDependencies();
+    }
+
   // Generate project files
   for (i = 0; i < this->LocalGenerators.size(); ++i)
     {
@@ -1043,14 +1057,6 @@
   return "None";
 }
 
-void cmGlobalGenerator::TraceDependencies()
-{ 
-  for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
-    {
-    this->LocalGenerators[i]->TraceDependencies();
-    }
-}
-
 void cmGlobalGenerator::FillProjectMap()
 { 
   this->ProjectMap.clear(); // make sure we start with a clean map
@@ -1176,7 +1182,8 @@
 
 
 cmTarget* cmGlobalGenerator::FindTarget(const char* project, 
-                                        const char* name)
+                                        const char* name,
+                                        bool useImportedTargets)
 {
   // if project specific
   if(project)
@@ -1184,7 +1191,8 @@
     std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
     for(unsigned int i = 0; i < gens->size(); ++i)
       {
-      cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name);
+      cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name, 
+                                                            useImportedTargets);
       if(ret)
         {
         return ret;
@@ -1194,13 +1202,22 @@
   // if all projects/directories
   else
     {
-    std::map<cmStdString,cmTarget *>::iterator i = 
-      this->TotalTargets.find(name);
-    if (i == this->TotalTargets.end())
+    std::map<cmStdString,cmTarget *>::iterator i =
+      this->TotalTargets.find ( name );
+    if ( i != this->TotalTargets.end() )
       {
-      return 0;
+      return i->second;
+      }
+    
+    if ( useImportedTargets )
+      {
+      std::map<cmStdString,cmTarget *>::iterator importedTarget =
+        this->ImportedTotalTargets.find ( name );
+      if ( importedTarget != this->ImportedTotalTargets.end() )
+        {
+        return importedTarget->second;
+        }
       }
-    return i->second;
     }
   return 0;
 }
@@ -1527,14 +1544,14 @@
       if(emitted.insert(lib->first).second)
         {
         cmTarget *target2 = 
-          target.GetMakefile()->FindTarget(lib->first.c_str());
-        
+          target.GetMakefile()->FindTarget(lib->first.c_str(), false);
+
         // search each local generator until a match is found
         if (!target2)
           {
-          target2 = this->FindTarget(0,lib->first.c_str());
+          target2 = this->FindTarget(0,lib->first.c_str(), false);
           }
-        
+
         // if a match was found then ...
         if (target2)
           {
@@ -1553,12 +1570,12 @@
     // Don't emit the same utility twice for this target.
     if(emitted.insert(*util).second)
       {
-      cmTarget *target2 = target.GetMakefile()->FindTarget(util->c_str());
+      cmTarget *target2 = target.GetMakefile()->FindTarget(util->c_str(), false);
       
       // search each local generator until a match is found
       if (!target2)
         {
-        target2 = this->FindTarget(0,util->c_str());
+        target2 = this->FindTarget(0,util->c_str(), false);
         }
       
       // if a match was found then ...
@@ -1572,3 +1589,14 @@
   return result;
 }
 
+void cmGlobalGenerator::AddTarget(cmTargets::value_type &v)
+{
+  if (v.second.IsImported())
+    {
+    this->ImportedTotalTargets[v.first] = &v.second;
+    }
+  else
+    {
+    this->TotalTargets[v.first] = &v.second;
+    }
+}

Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.82.2.1
retrieving revision 1.82.2.2
diff -u -d -r1.82.2.1 -r1.82.2.2
--- cmTarget.h	9 May 2007 15:44:58 -0000	1.82.2.1
+++ cmTarget.h	10 May 2007 15:41:49 -0000	1.82.2.2
@@ -54,6 +54,8 @@
    */
   void SetType(TargetType f, const char* name);
 
+  void MarkAsImported();
+  
   ///! Set/Get the name of the target
   const char* GetName() const {return this->Name.c_str();}
 
@@ -161,6 +163,8 @@
   const char *GetProperty(const char *prop);
   const char *GetProperty(const char *prop, cmProperty::ScopeType scope);
   bool GetPropertyAsBool(const char *prop);
+  
+  bool IsImported() const {return this->IsImportedTarget;}
 
   /** Get the directory in which this target will be built.  If the
       configuration name is given then the generator will add its
@@ -327,6 +331,12 @@
   void GetFullNameInternal(TargetType type, const char* config, bool implib,
                            std::string& outPrefix, std::string& outBase,
                            std::string& outSuffix);
+  void NormalGetFullNameInternal(TargetType type, const char* config, bool implib,
+                           std::string& outPrefix, std::string& outBase,
+                           std::string& outSuffix);
+  void ImportedGetFullNameInternal(TargetType type, const char* config, bool implib,
+                           std::string& outPrefix, std::string& outBase,
+                           std::string& outSuffix);
   void GetLibraryNamesInternal(std::string& name,
                                std::string& soName,
                                std::string& realName,
@@ -348,6 +358,10 @@
   // Get the full path to the target output directory.
   const char* GetOutputDir(bool implib);
 
+  const char* ImportedGetLocation(const char* config);
+  const char* NormalGetLocation(const char* config);
+  
+  
 private:
   std::string Name;
   std::vector<cmCustomCommand> PreBuildCommands;
@@ -376,6 +390,7 @@
   cmPropertyMap Properties;
   LinkLibraryVectorType OriginalLinkLibraries;
   bool DLLPlatform;
+  bool IsImportedTarget;
 
   // The cmMakefile instance that owns this target.  This should
   // always be set.

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.62.4.1
retrieving revision 1.62.4.2
diff -u -d -r1.62.4.1 -r1.62.4.2
--- cmMakefileTargetGenerator.cxx	9 May 2007 15:44:58 -0000	1.62.4.1
+++ cmMakefileTargetGenerator.cxx	10 May 2007 15:41:49 -0000	1.62.4.2
@@ -44,11 +44,6 @@
 {
   cmMakefileTargetGenerator *result = 0;
 
-  if (tgt->GetPropertyAsBool("IMPORTED") == true)
-    {
-    return result;
-    }
-
   switch (tgt->GetType())
     {
     case cmTarget::EXECUTABLE:
@@ -1199,7 +1194,7 @@
       {
       // Depend on other CMake targets.
       if(cmTarget* tgt =
-         this->GlobalGenerator->FindTarget(0, lib->first.c_str()))
+         this->GlobalGenerator->FindTarget(0, lib->first.c_str(), false))
         {
         if(const char* location =
            tgt->GetLocation(this->LocalGenerator->ConfigurationName.c_str()))

Index: cmGetTargetPropertyCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGetTargetPropertyCommand.cxx,v
retrieving revision 1.7
retrieving revision 1.7.8.1
diff -u -d -r1.7 -r1.7.8.1
--- cmGetTargetPropertyCommand.cxx	15 Mar 2006 16:02:02 -0000	1.7
+++ cmGetTargetPropertyCommand.cxx	10 May 2007 15:41:48 -0000	1.7.8.1
@@ -29,7 +29,7 @@
   const char* targetName = args[1].c_str();
 
   cmTarget *tgt = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
-    ->FindTarget(0,targetName);
+    ->FindTarget(0, targetName, true);
   if (tgt)
     {
     cmTarget& target = *tgt;

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.137.2.1
retrieving revision 1.137.2.2
diff -u -d -r1.137.2.1 -r1.137.2.2
--- cmTarget.cxx	9 May 2007 15:44:58 -0000	1.137.2.1
+++ cmTarget.cxx	10 May 2007 15:41:49 -0000	1.137.2.2
@@ -38,7 +38,7 @@
   this->LinkDirectoriesComputed = false;
   this->HaveInstallRule = false;
   this->DLLPlatform = false;
-
+  this->IsImportedTarget = false;
 }
 
 // define properties
@@ -90,7 +90,7 @@
 
   cm->DefineProperty
     ("EchoString", cmProperty::TARGET, 
-     "A message to be displayed when the target it built.",
+     "A message to be displayed when the target is built.",
      "A message to display on some generaters (such as makefiles) when "
      "the target is built.");
 
@@ -422,8 +422,8 @@
       {
       std::string command = *cit->begin();
       // see if we can find a target with this name
-      cmTarget* t =  this->Makefile->GetLocalGenerator()->
-                     GetGlobalGenerator()->FindTarget ( 0, command.c_str() );
+      cmTarget* t = this->Makefile->GetLocalGenerator()->
+                    GetGlobalGenerator()->FindTarget(0, command.c_str(), false);
       if ( ( t ) && ( t->GetType() ==cmTarget::EXECUTABLE ) )
         {
         this->AddUtility ( command.c_str() );
@@ -575,10 +575,8 @@
         const std::string& currentCommand = (*it)[0];
         // see if we can find a target with this name
         cmTarget* t =  this->Makefile->GetLocalGenerator()->
-            GetGlobalGenerator()->FindTarget(0, currentCommand.c_str());
-        if (( t)
-            && (t->GetType()==cmTarget::EXECUTABLE)
-            && (t->GetPropertyAsBool("IMPORTED") == false))
+            GetGlobalGenerator()->FindTarget(0, currentCommand.c_str(), false);
+        if (( t) && (t->GetType()==cmTarget::EXECUTABLE))
           {
           automaticTargetDepends.push_back(currentCommand);
           }
@@ -598,7 +596,7 @@
         bool isUtility = false;
         // see if we can find a target with this name
         cmTarget* t =  this->Makefile->GetLocalGenerator()->
-          GetGlobalGenerator()->FindTarget(0, dep.c_str());
+          GetGlobalGenerator()->FindTarget(0, dep.c_str(), false);
         if(t)
           {
           // if we find the target and the dep was given as a full
@@ -781,7 +779,7 @@
          this->Makefile->GetLocalGenerator()->GetGlobalGenerator())
         {
         tgt = (this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
-               ->FindTarget(0, lib.c_str()));
+               ->FindTarget(0, lib.c_str(), false));
         }
       if(tgt)
         {
@@ -1218,6 +1216,11 @@
   this->Properties.SetProperty(prop, value, cmProperty::TARGET);
 }
 
+void cmTarget::MarkAsImported()
+{
+  this->IsImportedTarget = true;
+}
+
 const char* cmTarget::GetDirectory(const char* config, bool implib)
 {
   if(config)
@@ -1236,12 +1239,33 @@
 
 const char* cmTarget::GetLocation(const char* config)
 {
-  // TODO this is just to make it work somehow
-  if (this->GetPropertyAsBool("IMPORTED"))
+  if (this->IsImported())
+  {
+    return this->ImportedGetLocation(config);
+  }
+  else
+  {
+    return this->NormalGetLocation(config);
+  }
+}
+
+const char* cmTarget::ImportedGetLocation(const char* config)
+{
+  std::string propertyName;
+  if ((config) && (strlen(config)))
     {
-    return this->GetProperty("IMPORTLOCATION");
+    propertyName=config;
+    propertyName+="_LOCATION";
     }
-    
+  else
+    {
+    propertyName="LOCATION";
+    }
+  return this->GetProperty(propertyName.c_str());  
+}
+
+const char* cmTarget::NormalGetLocation(const char* config)
+{
   this->Location = this->GetDirectory();
   if(!this->Location.empty())
     {
@@ -1337,33 +1361,43 @@
     return 0;
     }
 
-  // watch for special "computed" properties that are dependent on other
-  // properties or variables, always recompute them
-  if (!strcmp(prop,"LOCATION"))
-    {
-    // Set the LOCATION property of the target.  Note that this cannot take
-    // into account the per-configuration name of the target because the
-    // configuration type may not be known at CMake time.  We should
-    // deprecate this feature and instead support transforming an executable
-    // target name given as the command part of custom commands into the
-    // proper path at build time.  Alternatively we could put environment
-    // variable settings in all custom commands that hold the name of the
-    // target for each configuration and then give a reference to the
-    // variable in the location.
-    this->SetProperty("LOCATION", this->GetLocation(0));
-    }
-
-  // Per-configuration location can be computed.
-  int len = static_cast<int>(strlen(prop));
-  if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
-    {
-    std::string configName(prop, len-9);
-    this->SetProperty(prop, this->GetLocation(configName.c_str()));
-    }
-  
-  if(strcmp(prop, "OBJECT_FILES") == 0)
+    // don't use GetLocation() for imported targets, because there this
+    // calls GetProperty() to get the location...
+    if (!this->IsImported())
+      {
+      // watch for special "computed" properties that are dependent on other
+      // properties or variables, always recompute them
+      if (!strcmp(prop,"LOCATION"))
+        {
+        // Set the LOCATION property of the target.  Note that this cannot take
+        // into account the per-configuration name of the target because the
+        // configuration type may not be known at CMake time.  We should
+        // deprecate this feature and instead support transforming an executable
+        // target name given as the command part of custom commands into the
+        // proper path at build time.  Alternatively we could put environment
+        // variable settings in all custom commands that hold the name of the
+        // target for each configuration and then give a reference to the
+        // variable in the location.
+        this->SetProperty("LOCATION", this->GetLocation(0));
+        }
+    
+      // Per-configuration location can be computed.
+      int len = static_cast<int>(strlen(prop));
+      if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
+        {
+        std::string configName(prop, len-9);
+        this->SetProperty(prop, this->GetLocation(configName.c_str()));
+        }
+      
+      if(strcmp(prop, "OBJECT_FILES") == 0)
+        {
+        this->ComputeObjectFiles();
+        }
+      }
+    
+  if (strcmp(prop,"IMPORTED") == 0)
     {
-    this->ComputeObjectFiles();
+    return this->IsImported()?"TRUE":"FALSE";
     }
 
   // the type property returns what type the target is
@@ -1608,13 +1642,48 @@
   return prefix+base+suffix;
 }
 
-//----------------------------------------------------------------------------
 void cmTarget::GetFullNameInternal(TargetType type,
-                                   const char* config,
-                                   bool implib,
-                                   std::string& outPrefix,
-                                   std::string& outBase,
-                                   std::string& outSuffix)
+                                         const char* config,
+                                         bool implib,
+                                         std::string& outPrefix,
+                                         std::string& outBase,
+                                         std::string& outSuffix)
+{
+  if (this->IsImported())
+    {
+    this->ImportedGetFullNameInternal(type, config, implib,
+                                      outPrefix, outBase, outSuffix);
+    }
+  else
+    {
+    this->NormalGetFullNameInternal(type, config, implib,
+                                    outPrefix, outBase, outSuffix);
+    }
+}
+
+void cmTarget::ImportedGetFullNameInternal(TargetType type,
+                                         const char* config,
+                                         bool implib,
+                                         std::string& outPrefix,
+                                         std::string& outBase,
+                                         std::string& outSuffix)
+{
+  // find the basename, suffix and prefix from getLocation()
+  // implib ?
+  std::string location=this->GetLocation(config);
+  outBase=cmSystemTools::GetFilenameWithoutExtension(location);
+  outSuffix = cmSystemTools::GetFilenameExtension(location);
+  outPrefix.clear();
+}
+
+
+//----------------------------------------------------------------------------
+void cmTarget::NormalGetFullNameInternal(TargetType type,
+                                         const char* config,
+                                         bool implib,
+                                         std::string& outPrefix,
+                                         std::string& outBase,
+                                         std::string& outSuffix)
 {
   // Use just the target name for non-main target types.
   if(type != cmTarget::STATIC_LIBRARY &&

Index: cmAddExecutableCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddExecutableCommand.cxx,v
retrieving revision 1.29.6.1
retrieving revision 1.29.6.2
diff -u -d -r1.29.6.1 -r1.29.6.2
--- cmAddExecutableCommand.cxx	9 May 2007 15:44:58 -0000	1.29.6.1
+++ cmAddExecutableCommand.cxx	10 May 2007 15:41:48 -0000	1.29.6.2
@@ -63,8 +63,7 @@
     
   if (importTarget)
     {
-    cmTarget* target = this->Makefile->AddNewTarget(cmTarget::EXECUTABLE, exename.c_str());
-    target->SetProperty("IMPORTED","TRUE");
+    cmTarget* target = this->Makefile->AddNewTarget(cmTarget::EXECUTABLE, exename.c_str(), true);
     return true;
     }
 

Index: cmGlobalVisualStudio8Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.cxx,v
retrieving revision 1.19
retrieving revision 1.19.6.1
diff -u -d -r1.19 -r1.19.6.1
--- cmGlobalVisualStudio8Generator.cxx	10 Apr 2007 13:54:01 -0000	1.19
+++ cmGlobalVisualStudio8Generator.cxx	10 May 2007 15:41:49 -0000	1.19.6.1
@@ -94,7 +94,7 @@
       mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
                             no_working_directory, no_depends,
                             noCommandLines);
-      cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+      cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false);
       if(!tgt)
         {
         cmSystemTools::Error("Error adding target " 
@@ -146,7 +146,7 @@
         // target.
         const char* no_main_dependency = 0;
         const char* no_working_directory = 0;
-        mf->AddCustomCommandToOutput(
+        mf->AddCustomCommandToOutput(            // now again before TraceVSDep
           CMAKE_CHECK_BUILD_SYSTEM_TARGET ".vcproj.cmake", listFiles,
           no_main_dependency, commandLines, "Checking Build System",
           no_working_directory, true);

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.145
retrieving revision 1.145.2.1
diff -u -d -r1.145 -r1.145.2.1
--- cmGlobalXCodeGenerator.cxx	9 May 2007 12:25:45 -0000	1.145
+++ cmGlobalXCodeGenerator.cxx	10 May 2007 15:41:49 -0000	1.145.2.1
@@ -255,7 +255,7 @@
   mf->AddUtilityCommand("ALL_BUILD", true, no_depends,
                         no_working_directory,
                         "echo", "Build all projects");
-  cmTarget* allbuild = mf->FindTarget("ALL_BUILD");
+  cmTarget* allbuild = mf->FindTarget("ALL_BUILD", false);
   
   // Add XCODE depend helper 
   std::string dir = mf->GetCurrentOutputDirectory();
@@ -1019,8 +1019,7 @@
           cc.GetDepends().begin();
           d != cc.GetDepends().end(); ++d)
         {
-        if(!this->FindTarget(this->CurrentProject.c_str(),
-            d->c_str()))
+        if(!this->FindTarget(this->CurrentProject.c_str(), d->c_str(), false))
           {
           // if the depend is not a target but
           // is a full path then use it, if not then
@@ -1834,7 +1833,7 @@
         {
         // Add this dependency.
         cmTarget* t = this->FindTarget(this->CurrentProject.c_str(),
-                                       lib->first.c_str());
+                                       lib->first.c_str(), false);
         cmXCodeObject* dptarget = this->FindXCodeTarget(t);
         if(dptarget)
           {
@@ -1850,7 +1849,7 @@
       i != cmtarget->GetUtilities().end(); ++i)
     {
     cmTarget* t = this->FindTarget(this->CurrentProject.c_str(),
-                                   i->c_str());
+                                   i->c_str(), false);
     // if the target is in this project then make target depend
     // on it.  It may not be in this project if this is a sub
     // project from the top.

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.121
retrieving revision 1.121.2.1
diff -u -d -r1.121 -r1.121.2.1
--- cmLocalVisualStudio6Generator.cxx	9 May 2007 12:25:45 -0000	1.121
+++ cmLocalVisualStudio6Generator.cxx	10 May 2007 15:41:49 -0000	1.121.2.1
@@ -32,13 +32,16 @@
 {
 }
 
-
-void cmLocalVisualStudio6Generator::Generate()
-{ 
+void cmLocalVisualStudio6Generator::AddHelperCommands()
+{
   std::set<cmStdString> lang;
   lang.insert("C");
   lang.insert("CXX");
   this->CreateCustomTargetsAndCommands(lang);
+}
+
+void cmLocalVisualStudio6Generator::Generate()
+{
   this->OutputDSPFile();
 }
 
@@ -242,7 +245,7 @@
   cmCustomCommandLines commandLines;
   commandLines.push_back(commandLine);
   const char* no_working_directory = 0;
-  this->Makefile->AddCustomCommandToOutput(dspname.c_str(), listFiles,
+  this->Makefile->AddCustomCommandToOutput(dspname.c_str(), listFiles,      // may be broken, was directly before TraceVSDep 
                                            makefileIn.c_str(), commandLines,
                                            comment.c_str(),
                                            no_working_directory, true);
@@ -541,7 +544,7 @@
 
 void
 cmLocalVisualStudio6Generator
-::AddUtilityCommandHack(cmTarget& target, int count,
+  ::AddUtilityCommandHack(cmTarget& target, int count,
                         std::vector<std::string>& depends,
                         const cmCustomCommand& origCommand)
 {
@@ -554,7 +557,7 @@
 
   // Add the rule with the given dependencies and commands.
   const char* no_main_dependency = 0;
-  this->Makefile->AddCustomCommandToOutput(output,
+  this->Makefile->AddCustomCommandToOutput(output,  // was already after TraceVSDep
                                        depends,
                                        no_main_dependency,
                                        origCommand.GetCommandLines(),
@@ -1047,7 +1050,8 @@
       // Compute the proper name to use to link this library.
       std::string lib;
       std::string libDebug;
-      cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str());
+      cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str(), 
+                                                        false);
       if(tgt)
         {
         lib = cmSystemTools::GetFilenameWithoutExtension

Index: cmIncludeExternalMSProjectCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeExternalMSProjectCommand.cxx,v
retrieving revision 1.18.6.1
retrieving revision 1.18.6.2
diff -u -d -r1.18.6.1 -r1.18.6.2
--- cmIncludeExternalMSProjectCommand.cxx	9 May 2007 15:44:58 -0000	1.18.6.1
+++ cmIncludeExternalMSProjectCommand.cxx	10 May 2007 15:41:49 -0000	1.18.6.2
@@ -50,8 +50,7 @@
     cmSystemTools::ConvertToUnixSlashes(path);
 
     // Create a target instance for this utility.
-    cmTarget target;
-    target.SetType(cmTarget::UTILITY, utility_name.c_str());
+    cmTarget* target=this->Makefile->AddNewTarget(cmTarget::UTILITY, utility_name.c_str());
     target.SetProperty("EXCLUDE_FROM_ALL","FALSE");
     std::vector<std::string> no_outputs;
     cmCustomCommandLines commandLines;
@@ -61,9 +60,6 @@
     commandLines.push_back(commandLine);
     cmCustomCommand cc(no_outputs, depends, commandLines, 0, 0);
     target.GetPostBuildCommands().push_back(cc);
-
-    // Add the target to the set of targets.
-    this->Makefile->AddTarget(target);
     }
 #endif
   return true;

Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.20
retrieving revision 1.20.6.1
diff -u -d -r1.20 -r1.20.6.1
--- cmInstallCommand.cxx	19 Mar 2007 14:00:35 -0000	1.20
+++ cmInstallCommand.cxx	10 May 2007 15:41:49 -0000	1.20.6.1
@@ -252,7 +252,7 @@
     else if(doing_targets)
       {
       // Lookup this target in the current directory.
-      if(cmTarget* target = this->Makefile->FindTarget(args[i].c_str()))
+      if(cmTarget* target = this->Makefile->FindTarget(args[i].c_str(), false))
         {
         // Found the target.  Check its type.
         if(target->GetType() != cmTarget::EXECUTABLE &&

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.86
retrieving revision 1.86.2.1
diff -u -d -r1.86 -r1.86.2.1
--- cmGlobalVisualStudio7Generator.cxx	9 May 2007 12:25:45 -0000	1.86
+++ cmGlobalVisualStudio7Generator.cxx	10 May 2007 15:41:49 -0000	1.86.2.1
@@ -588,7 +588,9 @@
       if(j->first != dspname)
         {
         // is the library part of this SLN ? If so add dependency
-        if(this->FindTarget(this->CurrentProject.c_str(), j->first.c_str()))
+        if(this->FindTarget(this->CurrentProject.c_str(), 
+                            j->first.c_str()), 
+                            false)
           {
           std::string guid = this->GetGUID(j->first.c_str());
           if(guid.size() == 0)

Index: cmGlobalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio6Generator.cxx,v
retrieving revision 1.68
retrieving revision 1.68.2.1
diff -u -d -r1.68 -r1.68.2.1
--- cmGlobalVisualStudio6Generator.cxx	9 May 2007 12:25:45 -0000	1.68
+++ cmGlobalVisualStudio6Generator.cxx	10 May 2007 15:41:49 -0000	1.68.2.1
@@ -401,7 +401,7 @@
       if(j->first != dspname)
         {
         // is the library part of this DSW ? If so add dependency
-        if(this->FindTarget(0, j->first.c_str()))
+        if(this->FindTarget(0, j->first.c_str()), false)
           {
           fout << "Begin Project Dependency\n";
           fout << "Project_Dep_Name " << j->first.c_str() << "\n";

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.386.2.1
retrieving revision 1.386.2.2
diff -u -d -r1.386.2.1 -r1.386.2.2
--- cmMakefile.cxx	9 May 2007 15:44:58 -0000	1.386.2.1
+++ cmMakefile.cxx	10 May 2007 15:41:49 -0000	1.386.2.2
@@ -817,7 +817,7 @@
                                    bool escapeOldStyle, const char* comment)
 {
   // Create a target instance for this utility.
-  cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName);
+  cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName, false);
   if (excludeFromAll)
     {
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
@@ -925,7 +925,7 @@
   if ( i != this->Targets.end())
     {
     cmTarget* tgt = 
-      this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0, lib);
+      this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0, lib, false);
     if(tgt)
       {
       bool allowModules = true;
@@ -1332,16 +1332,16 @@
   switch (shared)
     {
     case 0:
-      target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname);
+      target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname, false);
       break;
     case 1:
-      target=this->AddNewTarget(cmTarget::SHARED_LIBRARY, lname);
+      target=this->AddNewTarget(cmTarget::SHARED_LIBRARY, lname, false);
       break;
     case 2:
-      target=this->AddNewTarget(cmTarget::MODULE_LIBRARY, lname);
+      target=this->AddNewTarget(cmTarget::MODULE_LIBRARY, lname, false);
       break;
     default:
-      target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname);
+      target=this->AddNewTarget(cmTarget::STATIC_LIBRARY, lname, false);
     }
 
   // Clear its dependencies. Otherwise, dependencies might persist
@@ -1360,7 +1360,7 @@
                                     const std::vector<std::string> &srcs,
                                     bool excludeFromAll)
 {
-  cmTarget* target = this->AddNewTarget(cmTarget::EXECUTABLE, exeName);
+  cmTarget* target = this->AddNewTarget(cmTarget::EXECUTABLE, exeName, false);
   if(excludeFromAll)
     {
     target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
@@ -1371,13 +1371,21 @@
 }
 
 
-cmTarget* cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name)
+cmTarget* cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name, bool isImported)
 {
+  cmTargets::iterator it;
   cmTarget target;
   target.SetType(type, name);
   target.SetMakefile(this);
-  cmTargets::iterator it = 
-    this->Targets.insert(cmTargets::value_type(target.GetName(), target)).first;
+  if (isImported)
+  {
+    target.MarkAsImported();
+    it=this->ImportedTargets.insert(cmTargets::value_type(target.GetName(), target)).first;
+  }
+  else
+  {
+    it=this->Targets.insert(cmTargets::value_type(target.GetName(), target)).first;
+  }
   this->LocalGenerator->GetGlobalGenerator()->AddTarget(*it);
   return &it->second;
 }
@@ -2671,7 +2679,7 @@
     return this->GetCMakeInstance()->GetProperty(prop,scope);
     }
 
-  return retVal;    
+  return retVal;
 }
 
 bool cmMakefile::GetPropertyAsBool(const char* prop)
@@ -2680,16 +2688,26 @@
 }
 
 
-cmTarget* cmMakefile::FindTarget(const char* name)
+cmTarget* cmMakefile::FindTarget(const char* name, bool useImportedTargets)
 {
   cmTargets& tgts = this->GetTargets();
-  
-  cmTargets::iterator i = tgts.find(name);
-  if (i == tgts.end())
+
+  cmTargets::iterator i = tgts.find ( name );
+  if ( i != tgts.end() )
     {
-    return 0;
+    return &i->second;
     }
-  return &i->second;
+
+  if (useImportedTargets)
+    {
+    cmTargets::iterator impTarget = this->ImportedTargets.find(name);
+    if (impTarget != this->ImportedTargets.end())
+      {
+      return &impTarget->second;
+      }
+    }
+
+  return 0;
 }
 
 cmTest* cmMakefile::CreateTest(const char* testName)

Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.215
retrieving revision 1.215.2.1
diff -u -d -r1.215 -r1.215.2.1
--- cmLocalGenerator.cxx	9 May 2007 12:25:45 -0000	1.215
+++ cmLocalGenerator.cxx	10 May 2007 15:41:49 -0000	1.215.2.1
@@ -147,8 +147,7 @@
     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))
+        && (strncmp(t->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
       {
       std::string projectFilename;
       if (this->IsMakefileGenerator == false)  // only use of this variable
@@ -610,7 +609,7 @@
   comment += this->Convert(ofname, START_OUTPUT);
 
   // Add the custom command to build the object file.
-  this->Makefile->AddCustomCommandToOutput(
+  this->Makefile->AddCustomCommandToOutput(         // ok (msvc6/7 only)
     ofname,
     depends,
     source.GetFullPath().c_str(),
@@ -701,7 +700,7 @@
   comment += llang;
   comment += " target ";
   comment += this->Convert(targetFullPath.c_str(), START_OUTPUT);
-  this->Makefile->AddCustomCommandToOutput(
+  this->Makefile->AddCustomCommandToOutput(           // ok (msvc6/7 only)
     targetFullPath.c_str(),
     objVector,
     0,
@@ -1721,7 +1720,7 @@
        (j->second == cmTarget::GENERAL || j->second == linkType))
       {
       // Compute the proper name to use to link this library.
-      cmTarget* tgt = this->GlobalGenerator->FindTarget(0, lib.c_str());
+      cmTarget* tgt = this->GlobalGenerator->FindTarget(0, lib.c_str(), false);
       bool impexe = (tgt &&
                      tgt->GetType() == cmTarget::EXECUTABLE &&
                      tgt->GetPropertyAsBool("ENABLE_EXPORTS"));
@@ -1951,7 +1950,7 @@
     }
 
   // Look for a CMake target with the given name.
-  if(cmTarget* target = this->GlobalGenerator->FindTarget(0, name.c_str()))
+  if(cmTarget* target = this->GlobalGenerator->FindTarget(0,name.c_str(),false))
     {
     // make sure it is not just a coincidence that the target name
     // found is part of the inName
@@ -2017,8 +2016,8 @@
 {
   std::string outName=inName;
   // Look for a CMake target with the given name.
-  cmTarget* target = this->GlobalGenerator->FindTarget(0, inName);
-  if ((target!=0) && (target->GetType()==cmTarget::EXECUTABLE))
+  cmTarget* target = this->GlobalGenerator->FindTarget(0, inName, true);
+  if ((target != 0) && (target->GetType() == cmTarget::EXECUTABLE))
     {
     outName = target->GetLocation( config );
     }

Index: cmLocalVisualStudio6Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.h,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -d -r1.17 -r1.17.2.1
--- cmLocalVisualStudio6Generator.h	9 May 2007 12:25:45 -0000	1.17
+++ cmLocalVisualStudio6Generator.h	10 May 2007 15:41:49 -0000	1.17.2.1
@@ -38,7 +38,9 @@
   cmLocalVisualStudio6Generator();
 
   virtual ~cmLocalVisualStudio6Generator();
-  
+
+  virtual void AddHelperCommands();
+
   /**
    * Generate the makefile for this directory. 
    */

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.28
retrieving revision 1.28.6.1
diff -u -d -r1.28 -r1.28.6.1
--- cmInstallTargetGenerator.cxx	19 Mar 2007 14:00:35 -0000	1.28
+++ cmInstallTargetGenerator.cxx	10 May 2007 15:41:49 -0000	1.28.6.1
@@ -361,7 +361,7 @@
       {
       if(cmTarget* tgt = this->Target->GetMakefile()->
          GetLocalGenerator()->GetGlobalGenerator()->
-         FindTarget(0, lib.c_str()))
+         FindTarget(0, lib.c_str(), false))
         {
         if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
           {

Index: cmGlobalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.cxx,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -d -r1.3 -r1.3.6.1
--- cmGlobalVisualStudioGenerator.cxx	10 Apr 2007 17:09:03 -0000	1.3
+++ cmGlobalVisualStudioGenerator.cxx	10 May 2007 15:41:49 -0000	1.3.6.1
@@ -104,7 +104,7 @@
         target.GetUtilities().begin();
       ui != target.GetUtilities().end(); ++ui)
     {
-    if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
+    if(cmTarget* depTarget = this->FindTarget(0, ui->c_str(), false))
       {
       if(depTarget->GetType() == cmTarget::STATIC_LIBRARY ||
          depTarget->GetType() == cmTarget::SHARED_LIBRARY ||
@@ -149,7 +149,7 @@
     this->CreateGUID(altNameStr.c_str());
 
     // The intermediate target should depend on the original target.
-    if(cmTarget* alt = this->FindTarget(0, altNameStr.c_str()))
+    if(cmTarget* alt = this->FindTarget(0, altNameStr.c_str(), false))
       {
       alt->AddUtility(target.GetName());
       }
@@ -205,7 +205,7 @@
     {
     // The depender is a target that links.  Lookup the dependee to
     // see if it provides an alternative dependency name.
-    if(cmTarget* depTarget = this->FindTarget(0, name))
+    if(cmTarget* depTarget = this->FindTarget(0, name, false))
       {
       // Check for an alternative name created by FixUtilityDepends.
       if(const char* altName =

Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.79
retrieving revision 1.79.2.1
diff -u -d -r1.79 -r1.79.2.1
--- cmLocalGenerator.h	9 May 2007 12:25:45 -0000	1.79
+++ cmLocalGenerator.h	10 May 2007 15:41:49 -0000	1.79.2.1
@@ -54,7 +54,9 @@
    * Calls TraceVSDependencies() on all targets of this generator.
    */
   virtual void TraceDependencies();
-  
+
+  virtual void AddHelperCommands() {}
+
   /**
    * Perform any final calculations prior to generation
    */

Index: cmSetTargetPropertiesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetTargetPropertiesCommand.cxx,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -d -r1.6 -r1.6.6.1
--- cmSetTargetPropertiesCommand.cxx	7 Feb 2007 16:49:42 -0000	1.6
+++ cmSetTargetPropertiesCommand.cxx	10 May 2007 15:41:49 -0000	1.6.6.1
@@ -96,7 +96,7 @@
                cmMakefile *mf)
 {
   cmTarget* target = 
-    mf->GetLocalGenerator()->GetGlobalGenerator()->FindTarget(0, tname);
+    mf->GetLocalGenerator()->GetGlobalGenerator()->FindTarget(0, tname, true);
   if ( target)
     {
     // now loop through all the props and set them

Index: cmGlobalVisualStudio71Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio71Generator.cxx,v
retrieving revision 1.39
retrieving revision 1.39.6.1
diff -u -d -r1.39 -r1.39.6.1
--- cmGlobalVisualStudio71Generator.cxx	10 Apr 2007 13:54:01 -0000	1.39
+++ cmGlobalVisualStudio71Generator.cxx	10 May 2007 15:41:49 -0000	1.39.6.1
@@ -333,7 +333,9 @@
       if(j->first != dspname)
         {
         // is the library part of this SLN ? If so add dependency
-        if(this->FindTarget(this->CurrentProject.c_str(), j->first.c_str()))
+        if(this->FindTarget(this->CurrentProject.c_str(), 
+                            j->first.c_str()), 
+                            false)
           {
           fout << "\t\t{" << this->GetGUID(j->first.c_str()) << "} = {"
                << this->GetGUID(j->first.c_str()) << "}\n";

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.200.6.1
retrieving revision 1.200.6.2
diff -u -d -r1.200.6.1 -r1.200.6.2
--- cmMakefile.h	9 May 2007 15:44:58 -0000	1.200.6.1
+++ cmMakefile.h	10 May 2007 15:41:49 -0000	1.200.6.2
@@ -165,7 +165,7 @@
   void AddDefineFlag(const char* definition);
   void RemoveDefineFlag(const char* definition);
 
-  cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name);
+  cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name, bool isImported);
   
   /**
    * Add an executable to the build.
@@ -416,8 +416,9 @@
    * Get the list of targets
    */
   cmTargets &GetTargets() { return this->Targets; }
+  const cmTargets &GetImportedTargets() const { return this->ImportedTargets; }
 
-  cmTarget* FindTarget(const char* name);
+  cmTarget* FindTarget(const char* name, bool useImportedTargets);
 
 
   /**
@@ -740,6 +741,7 @@
 
   // libraries, classes, and executables
   cmTargets Targets;
+  cmTargets ImportedTargets;
   std::vector<cmSourceFile*> SourceFiles;
 
   // Tests

Index: cmAddDependenciesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddDependenciesCommand.cxx,v
retrieving revision 1.14
retrieving revision 1.14.6.1
diff -u -d -r1.14 -r1.14.6.1
--- cmAddDependenciesCommand.cxx	7 Feb 2007 16:49:42 -0000	1.14
+++ cmAddDependenciesCommand.cxx	10 May 2007 15:41:48 -0000	1.14.6.1
@@ -32,7 +32,7 @@
 
   cmTarget* target = 
     this->GetMakefile()->GetLocalGenerator()->
-    GetGlobalGenerator()->FindTarget(0, target_name.c_str());
+    GetGlobalGenerator()->FindTarget(0, target_name.c_str(), false);
   if(target)
     {
     std::vector<std::string>::const_iterator s = args.begin();

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.205.2.1
retrieving revision 1.205.2.2
diff -u -d -r1.205.2.1 -r1.205.2.2
--- cmLocalUnixMakefileGenerator3.cxx	9 May 2007 15:44:58 -0000	1.205.2.1
+++ cmLocalUnixMakefileGenerator3.cxx	10 May 2007 15:41:49 -0000	1.205.2.2
@@ -338,12 +338,11 @@
   std::string localName;
   for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
     {
-    if ((t->second.GetPropertyAsBool("IMPORTED")==false) &&
-       ((t->second.GetType() == cmTarget::EXECUTABLE) ||
+    if ((t->second.GetType() == cmTarget::EXECUTABLE) ||
         (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
         (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
         (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
-        (t->second.GetType() == cmTarget::UTILITY)))
+        (t->second.GetType() == cmTarget::UTILITY))
       {
       emitted.insert(t->second.GetName());
 

Index: cmInstallFilesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallFilesCommand.cxx,v
retrieving revision 1.24
retrieving revision 1.24.6.1
diff -u -d -r1.24 -r1.24.6.1
--- cmInstallFilesCommand.cxx	12 Mar 2007 14:26:59 -0000	1.24
+++ cmInstallFilesCommand.cxx	10 May 2007 15:41:49 -0000	1.24.6.1
@@ -35,7 +35,7 @@
 
   // Create an INSTALL_FILES target specifically for this path.
   this->TargetName = "INSTALL_FILES_"+args[0];
-  cmTarget& target = this->Makefile->GetTargets()[this->TargetName];
+  cmTarget target = this->Makefile->GetTargets()[this->TargetName];
   target.SetType(cmTarget::INSTALL_FILES, this->TargetName.c_str());
   target.SetMakefile(this->Makefile);
   target.SetProperty("EXCLUDE_FROM_ALL","TRUE");



More information about the Cmake-commits mailing list