cmTargetCompileOptionsCommand.cxx 1.2 KB

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