mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 14:40:26 -06:00
ENH: Added support for selection of static/shared build on a per-library basis.
This commit is contained in:
@@ -50,10 +50,35 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string>& args)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string>::iterator s = args.begin();
|
||||
std::vector<std::string> srclists(++s, args.end());
|
||||
// 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();
|
||||
++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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user