Răsfoiți Sursa

VS: List config-specific object library files on link lines

In cases that we need to list object library files on link lines,
look up the set of files matching the configuration of each link
line.
Brad King 8 ani în urmă
părinte
comite
888c8af6cb
1 a modificat fișierele cu 10 adăugiri și 11 ștergeri
  1. 10 11
      Source/cmLocalVisualStudio7Generator.cxx

+ 10 - 11
Source/cmLocalVisualStudio7Generator.cxx

@@ -30,7 +30,7 @@ public:
   typedef cmComputeLinkInformation::ItemVector ItemVector;
   typedef cmComputeLinkInformation::ItemVector ItemVector;
   void OutputLibraries(std::ostream& fout, ItemVector const& libs);
   void OutputLibraries(std::ostream& fout, ItemVector const& libs);
   void OutputObjects(std::ostream& fout, cmGeneratorTarget* t,
   void OutputObjects(std::ostream& fout, cmGeneratorTarget* t,
-                     const char* isep = 0);
+                     std::string const& config, const char* isep = 0);
 
 
 private:
 private:
   cmLocalVisualStudio7Generator* LocalGenerator;
   cmLocalVisualStudio7Generator* LocalGenerator;
@@ -1043,7 +1043,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
           this->FortranProject) {
           this->FortranProject) {
         std::ostringstream libdeps;
         std::ostringstream libdeps;
-        this->Internal->OutputObjects(libdeps, target);
+        this->Internal->OutputObjects(libdeps, target, configName);
         if (!libdeps.str().empty()) {
         if (!libdeps.str().empty()) {
           fout << "\t\t\t\tAdditionalDependencies=\"" << libdeps.str()
           fout << "\t\t\t\tAdditionalDependencies=\"" << libdeps.str()
                << "\"\n";
                << "\"\n";
@@ -1096,7 +1096,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
            << this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
            << this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
           this->FortranProject) {
           this->FortranProject) {
-        this->Internal->OutputObjects(fout, target, " ");
+        this->Internal->OutputObjects(fout, target, configName, " ");
       }
       }
       fout << " ";
       fout << " ";
       this->Internal->OutputLibraries(fout, cli.GetItems());
       this->Internal->OutputLibraries(fout, cli.GetItems());
@@ -1181,7 +1181,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
            << this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
            << this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
       if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
           this->FortranProject) {
           this->FortranProject) {
-        this->Internal->OutputObjects(fout, target, " ");
+        this->Internal->OutputObjects(fout, target, configName, " ");
       }
       }
       fout << " ";
       fout << " ";
       this->Internal->OutputLibraries(fout, cli.GetItems());
       this->Internal->OutputLibraries(fout, cli.GetItems());
@@ -1300,21 +1300,20 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
 }
 }
 
 
 void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
 void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
-  std::ostream& fout, cmGeneratorTarget* gt, const char* isep)
+  std::ostream& fout, cmGeneratorTarget* gt, std::string const& configName,
+  const char* isep)
 {
 {
   // VS < 8 does not support per-config source locations so we
   // VS < 8 does not support per-config source locations so we
   // list object library content on the link line instead.
   // list object library content on the link line instead.
   cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
   cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
   std::string currentBinDir = lg->GetCurrentBinaryDirectory();
   std::string currentBinDir = lg->GetCurrentBinaryDirectory();
 
 
-  std::vector<cmSourceFile*> sources;
-  if (!gt->GetConfigCommonSourceFiles(sources)) {
-    return;
-  }
+  std::vector<cmSourceFile const*> objs;
+  gt->GetExternalObjects(objs, configName);
 
 
   const char* sep = isep ? isep : "";
   const char* sep = isep ? isep : "";
-  for (std::vector<cmSourceFile*>::const_iterator i = sources.begin();
-       i != sources.end(); i++) {
+  for (std::vector<cmSourceFile const*>::const_iterator i = objs.begin();
+       i != objs.end(); ++i) {
     if (!(*i)->GetObjectLibrary().empty()) {
     if (!(*i)->GetObjectLibrary().empty()) {
       std::string const& objFile = (*i)->GetFullPath();
       std::string const& objFile = (*i)->GetFullPath();
       std::string rel = lg->ConvertToRelativePath(currentBinDir, objFile);
       std::string rel = lg->ConvertToRelativePath(currentBinDir, objFile);