1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmAddLibraryCommand.cxx,v $
6 Date: $Date: 2002-05-02 17:17:10 $
7 Version: $Revision: 1.18 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmAddLibraryCommand.h"
18 #include "cmCacheManager.h"
21 bool cmAddLibraryCommand::InitialPass(std::vector
<std::string
> const& argsIn
)
23 if(argsIn
.size() < 1 )
25 this->SetError("called with incorrect number of arguments");
28 std::vector
<std::string
> args
;
29 cmSystemTools::ExpandListArguments(argsIn
, args
);
30 // Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
31 // otherwise it defaults to static library.
32 int shared
= !cmSystemTools::IsOff(m_Makefile
->GetDefinition("BUILD_SHARED_LIBS"));
34 std::vector
<std::string
>::const_iterator s
= args
.begin();
40 // If the second argument is "SHARED" or "STATIC", then it controls
41 // the type of library. Otherwise, it is treated as a source or
45 std::string libType
= *s
;
46 if(libType
== "STATIC")
51 else if(libType
== "SHARED")
56 else if(libType
== "MODULE")
63 std::vector
<std::string
> srclists
;
64 while (s
!= args
.end())
66 srclists
.push_back(*s
);
70 m_Makefile
->AddLibrary(m_LibName
.c_str(), shared
, srclists
);