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