cmLinkLibrariesCommand.cxx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmLinkLibrariesCommand.h"
  11. // cmLinkLibrariesCommand
  12. bool cmLinkLibrariesCommand
  13. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  14. {
  15. if(args.size() < 1 )
  16. {
  17. return true;
  18. }
  19. // add libraries, nothe that there is an optional prefix
  20. // of debug and optimized than can be used
  21. for(std::vector<std::string>::const_iterator i = args.begin();
  22. i != args.end(); ++i)
  23. {
  24. if (*i == "debug")
  25. {
  26. ++i;
  27. if(i == args.end())
  28. {
  29. this->SetError("The \"debug\" argument must be followed by "
  30. "a library");
  31. return false;
  32. }
  33. this->Makefile->AddLinkLibrary(*i,
  34. DEBUG_LibraryType);
  35. }
  36. else if (*i == "optimized")
  37. {
  38. ++i;
  39. if(i == args.end())
  40. {
  41. this->SetError("The \"optimized\" argument must be followed by "
  42. "a library");
  43. return false;
  44. }
  45. this->Makefile->AddLinkLibrary(*i,
  46. OPTIMIZED_LibraryType);
  47. }
  48. else
  49. {
  50. this->Makefile->AddLinkLibrary(*i);
  51. }
  52. }
  53. return true;
  54. }