cmTargetLinkOptionsCommand.cxx 1.2 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 "cmTargetLinkOptionsCommand.h"
  4. #include <sstream>
  5. #include "cmAlgorithms.h"
  6. #include "cmListFileCache.h"
  7. #include "cmMakefile.h"
  8. #include "cmMessageType.h"
  9. #include "cmTarget.h"
  10. class cmExecutionStatus;
  11. bool cmTargetLinkOptionsCommand::InitialPass(
  12. std::vector<std::string> const& args, cmExecutionStatus&)
  13. {
  14. return this->HandleArguments(args, "LINK_OPTIONS", PROCESS_BEFORE);
  15. }
  16. void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name)
  17. {
  18. std::ostringstream e;
  19. e << "Cannot specify link options for target \"" << name
  20. << "\" which is not built by this project.";
  21. this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
  22. }
  23. std::string cmTargetLinkOptionsCommand::Join(
  24. const std::vector<std::string>& content)
  25. {
  26. return cmJoin(content, ";");
  27. }
  28. bool cmTargetLinkOptionsCommand::HandleDirectContent(
  29. cmTarget* tgt, const std::vector<std::string>& content, bool prepend, bool)
  30. {
  31. cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
  32. tgt->InsertLinkOption(this->Join(content), lfbt, prepend);
  33. return true; // Successfully handled.
  34. }