cmTargetCompileOptionsCommand.cxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2013 Stephen Kelly <[email protected]>
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmTargetCompileOptionsCommand.h"
  11. bool cmTargetCompileOptionsCommand
  12. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  13. {
  14. return this->HandleArguments(args, "COMPILE_OPTIONS", PROCESS_BEFORE);
  15. }
  16. void cmTargetCompileOptionsCommand
  17. ::HandleImportedTarget(const std::string &tgt)
  18. {
  19. cmOStringStream e;
  20. e << "Cannot specify compile options for imported target \""
  21. << tgt << "\".";
  22. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  23. }
  24. void cmTargetCompileOptionsCommand
  25. ::HandleMissingTarget(const std::string &name)
  26. {
  27. cmOStringStream e;
  28. e << "Cannot specify compile options for target \"" << name << "\" "
  29. "which is not built by this project.";
  30. this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
  31. }
  32. //----------------------------------------------------------------------------
  33. std::string cmTargetCompileOptionsCommand
  34. ::Join(const std::vector<std::string> &content)
  35. {
  36. return cmJoin(content, ";");
  37. }
  38. //----------------------------------------------------------------------------
  39. bool cmTargetCompileOptionsCommand
  40. ::HandleDirectContent(cmTarget *tgt, const std::vector<std::string> &content,
  41. bool, bool)
  42. {
  43. cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
  44. cmValueWithOrigin entry(this->Join(content), lfbt);
  45. tgt->InsertCompileOption(entry);
  46. return true;
  47. }