cmTargetCompileFeaturesCommand.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "cmTargetCompileFeaturesCommand.h"
  4. #include "cmMakefile.h"
  5. #include "cmMessageType.h"
  6. #include "cmStringAlgorithms.h"
  7. class cmExecutionStatus;
  8. class cmTarget;
  9. bool cmTargetCompileFeaturesCommand::InitialPass(
  10. std::vector<std::string> const& args, cmExecutionStatus&)
  11. {
  12. return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS);
  13. }
  14. void cmTargetCompileFeaturesCommand::HandleMissingTarget(
  15. const std::string& name)
  16. {
  17. this->Makefile->IssueMessage(
  18. MessageType::FATAL_ERROR,
  19. cmStrCat("Cannot specify compile features for target \"", name,
  20. "\" which is not built by this project."));
  21. }
  22. std::string cmTargetCompileFeaturesCommand::Join(
  23. const std::vector<std::string>& content)
  24. {
  25. return cmJoin(content, ";");
  26. }
  27. bool cmTargetCompileFeaturesCommand::HandleDirectContent(
  28. cmTarget* tgt, const std::vector<std::string>& content, bool, bool)
  29. {
  30. for (std::string const& it : content) {
  31. std::string error;
  32. if (!this->Makefile->AddRequiredTargetFeature(tgt, it, &error)) {
  33. this->SetError(error);
  34. return false; // Not (successfully) handled.
  35. }
  36. }
  37. return true; // Successfully handled.
  38. }