From 63ca58ceafa459ec769d7c969852ab1f6fb30f7c Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 1 Aug 2003 13:13:43 -0400 Subject: ENH: allow lib prefix for to stay for nmake and borland make as it is not a system prefix --- Source/cmGlobalNMakeMakefileGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator.cxx | 9 +++++++++ Source/cmLocalUnixMakefileGenerator.h | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index a1db99f..08b48c8 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -40,6 +40,7 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator() lg->SetWindowsShell(true); lg->SetMakeSilentFlag("/nologo"); lg->SetGlobalGenerator(this); + lg->SetIgnoreLibPrefix(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index c28da66..d7a8520 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -31,6 +31,7 @@ cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator() m_WindowsShell = false; m_IncludeDirective = "include"; m_MakefileVariableSize = 0; + m_IgnoreLibPrefix = false; } cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator() @@ -601,11 +602,19 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, } cmsys::RegularExpression libname("^lib([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*"); cmsys::RegularExpression libname_noprefix("([^/]*)(\\.so|\\.lib|\\.dll|\\.sl|\\.a|\\.dylib).*"); + std::cout << "file is " << file << "\n"; if(libname.find(file)) { // Library had "lib" prefix. librariesLinked += libLinkFlag; file = libname.match(1); + // if ignore libprefix is on, + // then add the lib prefix back into the name + if(m_IgnoreLibPrefix) + { + std::cout << "m_IgnoreLibPrefix\n"; + file = "lib" + file; + } librariesLinked += file; if(linkSuffix.size() && !hasSuffix.find(file)) { diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h index b4fc54e..9b0d2d4 100644 --- a/Source/cmLocalUnixMakefileGenerator.h +++ b/Source/cmLocalUnixMakefileGenerator.h @@ -77,6 +77,10 @@ public: ///! Set max makefile variable size, default is 0 which means unlimited. void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; } + ///! If ignore lib prefix is true, then do not strip lib from the name of a library. + void SetIgnoreLibPrefix(bool s) { m_IgnoreLibPrefix = s; } + + protected: void AddDependenciesToSourceFile(cmDependInformation const*info, cmSourceFile *i, @@ -207,7 +211,7 @@ protected: int m_MakefileVariableSize; std::map m_MakeVariableMap; std::map m_ShortMakeVariableMap; - + bool m_IgnoreLibPrefix; std::string m_IncludeDirective; std::string m_MakeSilentFlag; std::string m_ExecutableOutputPath; -- cgit v0.12