cmLinkLibrariesCommand.cxx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmLinkLibrariesCommand.h"
  14. // cmLinkLibrariesCommand
  15. bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 1 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. // add libraries, nothe that there is an optional prefix
  23. // of debug and optimized than can be used
  24. for(std::vector<std::string>::const_iterator i = args.begin();
  25. i != args.end(); ++i)
  26. {
  27. if (*i == "debug")
  28. {
  29. ++i;
  30. m_Makefile->AddLinkLibrary(i->c_str(),
  31. cmTarget::DEBUG);
  32. }
  33. else if (*i == "optimized")
  34. {
  35. ++i;
  36. m_Makefile->AddLinkLibrary(i->c_str(),
  37. cmTarget::OPTIMIZED);
  38. }
  39. else
  40. {
  41. m_Makefile->AddLinkLibrary(i->c_str());
  42. }
  43. const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
  44. if (cmSystemTools::IsOff(ldir))
  45. {
  46. const char* dir = m_Makefile->GetDefinition(i->c_str());
  47. if( dir )
  48. {
  49. m_Makefile->AddLinkDirectory( dir );
  50. }
  51. }
  52. }
  53. return true;
  54. }