cmTargetCompileFeaturesCommand.cxx 1.3 KB

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