From 70b14df3f06177a1e65dfc9eb4bb4c0b0938a2a2 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 6 Apr 2001 17:01:57 -0400 Subject: [PATCH] BUG: fix depends for libraries and executables in the same dir --- Source/cmDSPMakefile.cxx | 31 ++++++++++++++++++++++++++++--- Source/cmDSPMakefile.h | 3 ++- Source/cmDSPWriter.cxx | 31 ++++++++++++++++++++++++++++--- Source/cmDSPWriter.h | 3 ++- Source/cmDSWMakefile.cxx | 2 +- Source/cmDSWWriter.cxx | 2 +- 6 files changed, 62 insertions(+), 10 deletions(-) diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx index ac0688e53..0d8928c0e 100644 --- a/Source/cmDSPMakefile.cxx +++ b/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; +} + + + diff --git a/Source/cmDSPMakefile.h b/Source/cmDSPMakefile.h index f1a2003c4..9d8269658 100644 --- a/Source/cmDSPMakefile.h +++ b/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 m_Configurations; diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index ac0688e53..0d8928c0e 100644 --- a/Source/cmDSPWriter.cxx +++ b/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; +} + + + diff --git a/Source/cmDSPWriter.h b/Source/cmDSPWriter.h index f1a2003c4..9d8269658 100644 --- a/Source/cmDSPWriter.h +++ b/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 m_Configurations; diff --git a/Source/cmDSWMakefile.cxx b/Source/cmDSWMakefile.cxx index a61e2e915..a7fb01010 100644 --- a/Source/cmDSWMakefile.cxx +++ b/Source/cmDSWMakefile.cxx @@ -126,7 +126,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout, std::vector::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) { diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx index a61e2e915..a7fb01010 100644 --- a/Source/cmDSWWriter.cxx +++ b/Source/cmDSWWriter.cxx @@ -126,7 +126,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout, std::vector::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) {