cmTargetSourcesCommand.cxx 1.1 KB

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