FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmLinkLibrariesCommand.cxx
blob6a39b0ef1b1601bc89d1f271977527d095af3961
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmLinkLibrariesCommand.cxx,v $
5 Language: C++
6 Date: $Date: 2002-07-22 14:01:53 $
7 Version: $Revision: 1.14 $
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 "cmLinkLibrariesCommand.h"
19 // cmLinkLibrariesCommand
20 bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& argsIn)
22 if(argsIn.size() < 1 )
24 return true;
26 std::vector<std::string> args;
27 cmSystemTools::ExpandListArguments(argsIn, args);
28 // add libraries, nothe that there is an optional prefix
29 // of debug and optimized than can be used
30 for(std::vector<std::string>::const_iterator i = args.begin();
31 i != args.end(); ++i)
33 if (*i == "debug")
35 ++i;
36 m_Makefile->AddLinkLibrary(i->c_str(),
37 cmTarget::DEBUG);
39 else if (*i == "optimized")
41 ++i;
42 m_Makefile->AddLinkLibrary(i->c_str(),
43 cmTarget::OPTIMIZED);
45 else
47 m_Makefile->AddLinkLibrary(i->c_str());
50 const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
51 if (cmSystemTools::IsOff(ldir))
53 std::string libPath = *i + "_CMAKE_PATH";
54 const char* dir = m_Makefile->GetDefinition(libPath.c_str());
55 if( dir )
57 m_Makefile->AddLinkDirectory( dir );
60 else
62 m_Makefile->AddLinkDirectory( ldir );
66 return true;