cmTargetCompileOptionsCommand.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #ifndef cmTargetCompileOptionsCommand_h
  11. #define cmTargetCompileOptionsCommand_h
  12. #include "cmTargetPropCommandBase.h"
  13. class cmTargetCompileOptionsCommand : public cmTargetPropCommandBase
  14. {
  15. public:
  16. /**
  17. * This is a virtual constructor for the command.
  18. */
  19. virtual cmCommand* Clone()
  20. {
  21. return new cmTargetCompileOptionsCommand;
  22. }
  23. /**
  24. * This is called when the command is first encountered in
  25. * the CMakeLists.txt file.
  26. */
  27. virtual bool InitialPass(std::vector<std::string> const& args,
  28. cmExecutionStatus &status);
  29. /**
  30. * The name of the command as specified in CMakeList.txt.
  31. */
  32. virtual const char* GetName() const { return "target_compile_options";}
  33. /**
  34. * Succinct documentation.
  35. */
  36. virtual const char* GetTerseDocumentation() const
  37. {
  38. return
  39. "Add compile options to a target.";
  40. }
  41. /**
  42. * More documentation.
  43. */
  44. virtual const char* GetFullDocumentation() const
  45. {
  46. return
  47. " target_compile_options(<target> [BEFORE] "
  48. "<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
  49. " [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
  50. "Specify compile options to use when compiling a given target. "
  51. "The named <target> must have been created by a command such as "
  52. "add_executable or add_library and must not be an IMPORTED target. "
  53. "If BEFORE is specified, the content will be prepended to the property "
  54. "instead of being appended.\n"
  55. "The INTERFACE, PUBLIC and PRIVATE keywords are required to specify "
  56. "the scope of the following arguments. PRIVATE and PUBLIC items will "
  57. "populate the COMPILE_OPTIONS property of <target>. PUBLIC and "
  58. "INTERFACE items will populate the INTERFACE_COMPILE_OPTIONS "
  59. "property of <target>. "
  60. "The following arguments specify compile opitions. "
  61. "Repeated calls for the same <target> append items in the order called."
  62. "\n"
  63. "Arguments to target_compile_options may use \"generator "
  64. "expressions\" with the syntax \"$<...>\". "
  65. CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
  66. ;
  67. }
  68. cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase);
  69. private:
  70. virtual void HandleImportedTarget(const std::string &tgt);
  71. virtual void HandleMissingTarget(const std::string &name);
  72. virtual void HandleDirectContent(cmTarget *tgt,
  73. const std::vector<std::string> &content,
  74. bool prepend, bool system);
  75. virtual std::string Join(const std::vector<std::string> &content);
  76. };
  77. #endif