cmLinkLibrariesCommand.cxx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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. return true;
  20. }
  21. // add libraries, nothe that there is an optional prefix
  22. // of debug and optimized than can be used
  23. for(std::vector<std::string>::const_iterator i = args.begin();
  24. i != args.end(); ++i)
  25. {
  26. if (*i == "debug")
  27. {
  28. ++i;
  29. if(i == args.end())
  30. {
  31. this->SetError("The \"debug\" argument must be followed by a library");
  32. return false;
  33. }
  34. this->Makefile->AddLinkLibrary(i->c_str(),
  35. cmTarget::DEBUG);
  36. }
  37. else if (*i == "optimized")
  38. {
  39. ++i;
  40. if(i == args.end())
  41. {
  42. this->SetError("The \"optimized\" argument must be followed by a library");
  43. return false;
  44. }
  45. this->Makefile->AddLinkLibrary(i->c_str(),
  46. cmTarget::OPTIMIZED);
  47. }
  48. else
  49. {
  50. this->Makefile->AddLinkLibrary(i->c_str());
  51. }
  52. }
  53. return true;
  54. }