summaryrefslogtreecommitdiffstats
path: root/Source/cmAddLibraryCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-07-02 19:38:02 (GMT)
committerBrad King <brad.king@kitware.com>2001-07-02 19:38:02 (GMT)
commite693d47253157c9372aeb7c2edbecef8d1fb6225 (patch)
tree296e6789a8596e112f2139b13e71b53219309bd0 /Source/cmAddLibraryCommand.cxx
parentae2723878e08a8aa016869e90711e260d981df38 (diff)
downloadCMake-e693d47253157c9372aeb7c2edbecef8d1fb6225.zip
CMake-e693d47253157c9372aeb7c2edbecef8d1fb6225.tar.gz
CMake-e693d47253157c9372aeb7c2edbecef8d1fb6225.tar.bz2
ENH: Added support for selection of static/shared build on a per-library basis.
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r--Source/cmAddLibraryCommand.cxx29
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;
}