cmLinkLibrariesCommand.cxx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmLinkLibrariesCommand.h"
  4. // cmLinkLibrariesCommand
  5. bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
  6. cmExecutionStatus&)
  7. {
  8. if (args.empty()) {
  9. return true;
  10. }
  11. // add libraries, nothe that there is an optional prefix
  12. // of debug and optimized than can be used
  13. for (std::vector<std::string>::const_iterator i = args.begin();
  14. i != args.end(); ++i) {
  15. if (*i == "debug") {
  16. ++i;
  17. if (i == args.end()) {
  18. this->SetError("The \"debug\" argument must be followed by "
  19. "a library");
  20. return false;
  21. }
  22. this->Makefile->AddLinkLibrary(*i, DEBUG_LibraryType);
  23. } else if (*i == "optimized") {
  24. ++i;
  25. if (i == args.end()) {
  26. this->SetError("The \"optimized\" argument must be followed by "
  27. "a library");
  28. return false;
  29. }
  30. this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType);
  31. } else {
  32. this->Makefile->AddLinkLibrary(*i, GENERAL_LibraryType);
  33. }
  34. }
  35. return true;
  36. }