cmLinkLibrariesCommand.cxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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::InitialPass(std::vector<std::string> const& args,
  13. cmExecutionStatus&)
  14. {
  15. if (args.empty()) {
  16. return true;
  17. }
  18. // add libraries, nothe that there is an optional prefix
  19. // of debug and optimized than can be used
  20. for (std::vector<std::string>::const_iterator i = args.begin();
  21. i != args.end(); ++i) {
  22. if (*i == "debug") {
  23. ++i;
  24. if (i == args.end()) {
  25. this->SetError("The \"debug\" argument must be followed by "
  26. "a library");
  27. return false;
  28. }
  29. this->Makefile->AddLinkLibrary(*i, DEBUG_LibraryType);
  30. } else if (*i == "optimized") {
  31. ++i;
  32. if (i == args.end()) {
  33. this->SetError("The \"optimized\" argument must be followed by "
  34. "a library");
  35. return false;
  36. }
  37. this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType);
  38. } else {
  39. this->Makefile->AddLinkLibrary(*i);
  40. }
  41. }
  42. return true;
  43. }