浏览代码

Store direct dependencies in solutions for VS >= 8

Since commit bc43b0f2 (Do not link library dependencies in VS solutions,
2009-10-20) CMake disables for VS >= 8 linking of a target to libraries
that happen to be listed as solution-level dependencies.  Therefore we
can list the direct dependencies of each target in the solution file and
let VS handle transitive dependencies automatically.
Brad King 15 年之前
父节点
当前提交
1a0c166a26
共有 3 个文件被更改,包括 18 次插入3 次删除
  1. 2 3
      Source/cmGlobalGenerator.cxx
  2. 14 0
      Source/cmGlobalVisualStudio8Generator.cxx
  3. 2 0
      Source/cmGlobalVisualStudio8Generator.h

+ 2 - 3
Source/cmGlobalGenerator.cxx

@@ -699,9 +699,8 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
          l != targets.end(); l++)
          l != targets.end(); l++)
       {
       {
       cmTarget& target = l->second;
       cmTarget& target = l->second;
-      std::set<cmStdString>::const_iterator pos =
-        target.GetUtilities().find(targetIn->GetName());
-      if(pos != target.GetUtilities().end())
+      TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+      if(tgtdeps.count(targetIn))
         {
         {
         return true;
         return true;
         }
         }

+ 14 - 0
Source/cmGlobalVisualStudio8Generator.cxx

@@ -288,6 +288,20 @@ cmGlobalVisualStudio8Generator
     }
     }
 }
 }
 
 
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio8Generator::WriteProjectDepends(
+  std::ostream& fout, const char*, const char*, cmTarget& t)
+{
+  TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
+  OrderedTargetDependSet depends(unordered);
+  for(OrderedTargetDependSet::const_iterator i = depends.begin();
+      i != depends.end(); ++i)
+    {
+    std::string guid = this->GetGUID((*i)->GetName());
+    fout << "\t\t{" << guid << "} = {" << guid << "}\n";
+    }
+}
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
 bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
   cmTarget& target)
   cmTarget& target)

+ 2 - 0
Source/cmGlobalVisualStudio8Generator.h

@@ -78,6 +78,8 @@ protected:
   virtual void WriteProjectConfigurations(std::ostream& fout,
   virtual void WriteProjectConfigurations(std::ostream& fout,
                                           const char* name,
                                           const char* name,
                                           bool partOfDefaultBuild);
                                           bool partOfDefaultBuild);
+  virtual void WriteProjectDepends(std::ostream& fout, const char* name,
+                                   const char* path, cmTarget &t);
 
 
   const char* ArchitectureId;
   const char* ArchitectureId;
 };
 };