1
0
Эх сурвалжийг харах

BUG: fix depends for libraries and executables in the same dir

Bill Hoffman 24 жил өмнө
parent
commit
70b14df3f0

+ 28 - 3
Source/cmDSPMakefile.cxx

@@ -73,6 +73,7 @@ void cmDSPMakefile::OutputDSPFile()
     m_LibraryOptions += "/$(OUTDIR)\" ";
     }
   m_LibraryOptions += "/STACK:10000000 ";
+  m_OutputLibName = m_Makefile->GetLibraryName();
   
   // Create the DSP or set of DSP's for libraries and executables
   if(strlen(m_Makefile->GetLibraryName()) != 0)
@@ -115,9 +116,10 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
         }
       else
         {
-        m_Makefile->SetLibraryName(classfile.m_ClassName.c_str());
+//        m_Makefile->SetLibraryName(classfile.m_ClassName.c_str());
         this->SetBuildType(EXECUTABLE);
-        std::string pname = m_Makefile->GetLibraryName();
+        m_OutputLibName = classfile.m_ClassName;
+        std::string pname = classfile.m_ClassName.c_str(); //m_Makefile->GetLibraryName();
         m_CreatedProjectNames.push_back(pname);
         
         this->WriteDSPHeader(fout);
@@ -412,7 +414,7 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
       cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
                                     m_IncludeOptions.c_str());
       cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", 
-                                    m_Makefile->GetLibraryName());
+                                    m_OutputLibName.c_str());
       cmSystemTools::ReplaceString(line, 
                                     "EXTRA_DEFINES", 
 				   m_Makefile->GetDefineFlags());
@@ -445,3 +447,26 @@ void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout, const char* path)
        << path << "\n";
   fout << "# End Source File\n";
 }
+
+bool cmDSPMakefile::NeedsDependencies(const char* dspname)
+{
+  if(strcmp(m_Makefile->GetLibraryName(), dspname) == 0)
+    {
+    // only shared libs need depend info
+    const char* cacheValue
+      = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
+    if(cacheValue && strcmp(cacheValue,"0"))
+      {
+      return true;
+      }
+    else
+      {
+      return false;
+      }
+    }
+  // must be an executable so it needs depends
+  return true;
+}
+
+  
+  

+ 2 - 1
Source/cmDSPMakefile.h

@@ -61,7 +61,7 @@ public:
     {
     return m_Makefile;
     }
-  
+  bool NeedsDependencies(const char* dspname);
 private:
   std::string m_DSPHeaderTemplate;
   std::string m_DSPFooterTemplate;
@@ -86,6 +86,7 @@ private:
 
   std::string m_IncludeOptions;
   std::string m_LibraryOptions;
+  std::string m_OutputLibName;
   cmMakefile* m_Makefile;
   BuildType m_BuildType;
   std::vector<std::string> m_Configurations;

+ 28 - 3
Source/cmDSPWriter.cxx

@@ -73,6 +73,7 @@ void cmDSPMakefile::OutputDSPFile()
     m_LibraryOptions += "/$(OUTDIR)\" ";
     }
   m_LibraryOptions += "/STACK:10000000 ";
+  m_OutputLibName = m_Makefile->GetLibraryName();
   
   // Create the DSP or set of DSP's for libraries and executables
   if(strlen(m_Makefile->GetLibraryName()) != 0)
@@ -115,9 +116,10 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
         }
       else
         {
-        m_Makefile->SetLibraryName(classfile.m_ClassName.c_str());
+//        m_Makefile->SetLibraryName(classfile.m_ClassName.c_str());
         this->SetBuildType(EXECUTABLE);
-        std::string pname = m_Makefile->GetLibraryName();
+        m_OutputLibName = classfile.m_ClassName;
+        std::string pname = classfile.m_ClassName.c_str(); //m_Makefile->GetLibraryName();
         m_CreatedProjectNames.push_back(pname);
         
         this->WriteDSPHeader(fout);
@@ -412,7 +414,7 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
       cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
                                     m_IncludeOptions.c_str());
       cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME", 
-                                    m_Makefile->GetLibraryName());
+                                    m_OutputLibName.c_str());
       cmSystemTools::ReplaceString(line, 
                                     "EXTRA_DEFINES", 
 				   m_Makefile->GetDefineFlags());
@@ -445,3 +447,26 @@ void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout, const char* path)
        << path << "\n";
   fout << "# End Source File\n";
 }
+
+bool cmDSPMakefile::NeedsDependencies(const char* dspname)
+{
+  if(strcmp(m_Makefile->GetLibraryName(), dspname) == 0)
+    {
+    // only shared libs need depend info
+    const char* cacheValue
+      = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
+    if(cacheValue && strcmp(cacheValue,"0"))
+      {
+      return true;
+      }
+    else
+      {
+      return false;
+      }
+    }
+  // must be an executable so it needs depends
+  return true;
+}
+
+  
+  

+ 2 - 1
Source/cmDSPWriter.h

@@ -61,7 +61,7 @@ public:
     {
     return m_Makefile;
     }
-  
+  bool NeedsDependencies(const char* dspname);
 private:
   std::string m_DSPHeaderTemplate;
   std::string m_DSPFooterTemplate;
@@ -86,6 +86,7 @@ private:
 
   std::string m_IncludeOptions;
   std::string m_LibraryOptions;
+  std::string m_OutputLibName;
   cmMakefile* m_Makefile;
   BuildType m_BuildType;
   std::vector<std::string> m_Configurations;

+ 1 - 1
Source/cmDSWMakefile.cxx

@@ -126,7 +126,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
   std::vector<std::string>::iterator i, end;
   i = project->GetMakefile()->GetLinkLibraries().begin();
   end = project->GetMakefile()->GetLinkLibraries().end();
-  if(project->GetBuildType() != cmDSPMakefile::STATIC_LIBRARY)
+  if(project->NeedsDependencies(dspname))
     {
     for(;i!= end; ++i)
       {

+ 1 - 1
Source/cmDSWWriter.cxx

@@ -126,7 +126,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
   std::vector<std::string>::iterator i, end;
   i = project->GetMakefile()->GetLinkLibraries().begin();
   end = project->GetMakefile()->GetLinkLibraries().end();
-  if(project->GetBuildType() != cmDSPMakefile::STATIC_LIBRARY)
+  if(project->NeedsDependencies(dspname))
     {
     for(;i!= end; ++i)
       {