diff options
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index c49a4f6..f607df3 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -50,10 +50,35 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string>& args) return false; } + // Library type defaults to value of BUILD_SHARED_LIBS, if it exists, + // otherwise it defaults to static library. + bool shared = !cmSystemTools::IsOff(m_Makefile->GetDefinition("BUILD_SHARED_LIBS")); + std::vector<std::string>::iterator s = args.begin(); - std::vector<std::string> srclists(++s, args.end()); + ++s; + + // If the second argument is "SHARED" or "STATIC", then it controls + // the type of library. Otherwise, it is treated as a source or + // source list name. + if(s != args.end()) + { + std::string libType = *s; + m_Makefile->ExpandVariablesInString(libType); + if(libType == "STATIC") + { + ++s; + shared = false; + } + else if(libType == "SHARED") + { + ++s; + shared = true; + } + } + std::vector<std::string> srclists(s, args.end()); + + m_Makefile->AddLibrary(args[0].c_str(), shared, srclists); - m_Makefile->AddLibrary(args[0].c_str(),srclists); return true; } |