cmLinkLibrariesCommand.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #include "cmMakefile.h"
  5. class cmExecutionStatus;
  6. // cmLinkLibrariesCommand
  7. bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
  8. cmExecutionStatus&)
  9. {
  10. if (args.empty()) {
  11. return true;
  12. }
  13. // add libraries, nothe that there is an optional prefix
  14. // of debug and optimized than can be used
  15. for (std::vector<std::string>::const_iterator i = args.begin();
  16. i != args.end(); ++i) {
  17. if (*i == "debug") {
  18. ++i;
  19. if (i == args.end()) {
  20. this->SetError("The \"debug\" argument must be followed by "
  21. "a library");
  22. return false;
  23. }
  24. this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
  25. } else if (*i == "optimized") {
  26. ++i;
  27. if (i == args.end()) {
  28. this->SetError("The \"optimized\" argument must be followed by "
  29. "a library");
  30. return false;
  31. }
  32. this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
  33. }
  34. this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
  35. }
  36. return true;
  37. }