BUG: Check for building shared libraries should read from the make file's setting, not directly from the cache.

This commit is contained in:
Brad King 2001-06-27 15:13:26 -04:00
parent 459dfc7531
commit 7bb9fdbeef
2 changed files with 15 additions and 9 deletions

View File

@ -239,6 +239,12 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
} }
bool cmUnixMakefileGenerator::BuildingSharedLibs() const
{
return !cmSystemTools::IsOff(m_Makefile->GetDefinition("BUILD_SHARED_LIBS"));
}
// Output the rules for any targets // Output the rules for any targets
void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{ {
@ -246,7 +252,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
fout << "TARGETS = "; fout << "TARGETS = ";
const cmTargets &tgts = m_Makefile->GetTargets(); const cmTargets &tgts = m_Makefile->GetTargets();
// list libraries first // list libraries first
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool dll = this->BuildingSharedLibs();
for(cmTargets::const_iterator l = tgts.begin(); for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
@ -332,7 +338,7 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::set<std::string> emitted; std::set<std::string> emitted;
// Embed runtime search paths if possible and if required. // Embed runtime search paths if possible and if required.
bool outputRuntime = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool outputRuntime = this->BuildingSharedLibs();
std::string runtimeFlag; std::string runtimeFlag;
std::string runtimeSep; std::string runtimeSep;
std::vector<std::string> runtimeDirs; std::vector<std::string> runtimeDirs;
@ -478,9 +484,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout) void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
{ {
bool dll = this->BuildingSharedLibs();
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS");
// for each target // for each target
const cmTargets &tgts = m_Makefile->GetTargets(); const cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::const_iterator l = tgts.begin(); for(cmTargets::const_iterator l = tgts.begin();
@ -562,7 +567,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
libpath += "/lib"; libpath += "/lib";
} }
libpath += lib2->first; libpath += lib2->first;
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool dll = this->BuildingSharedLibs();
if(dll) if(dll)
{ {
libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX"); libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
@ -593,7 +598,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
{ {
std::string library = "lib"; std::string library = "lib";
library += lib2->first; library += lib2->first;
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool dll = this->BuildingSharedLibs();
if(dll) if(dll)
{ {
library += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX"); library += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
@ -947,7 +952,7 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"\n" "\n"
"\n"; "\n";
std::string replaceVars = variables; std::string replaceVars = variables;
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool dll = this->BuildingSharedLibs();
if(!dll) if(!dll)
{ {
// if not a dll then remove the shlib -fpic flag // if not a dll then remove the shlib -fpic flag
@ -963,7 +968,7 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout) void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
{ {
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); bool dll = this->BuildingSharedLibs();
const char* root const char* root
= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT"); = cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
fout << "INSTALL = " << root << "/Templates/install-sh -c\n"; fout << "INSTALL = " << root << "/Templates/install-sh -c\n";

View File

@ -94,6 +94,7 @@ private:
void RecursiveGenerateCacheOnly(); void RecursiveGenerateCacheOnly();
void ProcessDepends(const cmMakeDepend &md); void ProcessDepends(const cmMakeDepend &md);
void GenerateCacheOnly(); void GenerateCacheOnly();
bool BuildingSharedLibs() const;
void OutputMakefile(const char* file); void OutputMakefile(const char* file);
void OutputMakeFlags(std::ostream&); void OutputMakeFlags(std::ostream&);
void OutputTargetRules(std::ostream& fout); void OutputTargetRules(std::ostream& fout);