cmTargetIncludeDirectoriesCommand.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 cmTargetIncludeDirectoriesCommand_h
  11. #define cmTargetIncludeDirectoriesCommand_h
  12. #include "cmTargetPropCommandBase.h"
  13. //----------------------------------------------------------------------------
  14. class cmTargetIncludeDirectoriesCommand : public cmTargetPropCommandBase
  15. {
  16. public:
  17. /**
  18. * This is a virtual constructor for the command.
  19. */
  20. virtual cmCommand* Clone()
  21. {
  22. return new cmTargetIncludeDirectoriesCommand;
  23. }
  24. /**
  25. * This is called when the command is first encountered in
  26. * the CMakeLists.txt file.
  27. */
  28. virtual bool InitialPass(std::vector<std::string> const& args,
  29. cmExecutionStatus &status);
  30. /**
  31. * The name of the command as specified in CMakeList.txt.
  32. */
  33. virtual const char* GetName() const { return "target_include_directories";}
  34. /**
  35. * Succinct documentation.
  36. */
  37. virtual const char* GetTerseDocumentation() const
  38. {
  39. return
  40. "Add include directories to a target.";
  41. }
  42. /**
  43. * More documentation.
  44. */
  45. virtual const char* GetFullDocumentation() const
  46. {
  47. return
  48. " target_include_directories(<target> [SYSTEM] [BEFORE] "
  49. "<INTERFACE|PUBLIC|PRIVATE> [items1...]\n"
  50. " [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])\n"
  51. "Specify include directories or targets to use when compiling a given "
  52. "target. "
  53. "The named <target> must have been created by a command such as "
  54. "add_executable or add_library and must not be an IMPORTED target.\n"
  55. "If BEFORE is specified, the content will be prepended to the property "
  56. "instead of being appended.\n"
  57. "The INTERFACE, PUBLIC and PRIVATE keywords are required to specify "
  58. "the scope of the following arguments. PRIVATE and PUBLIC items will "
  59. "populate the INCLUDE_DIRECTORIES property of <target>. PUBLIC and "
  60. "INTERFACE items will populate the INTERFACE_INCLUDE_DIRECTORIES "
  61. "property of <target>. "
  62. "The following arguments specify include directories. Specified "
  63. "include directories may be absolute paths or relative paths. "
  64. "Repeated calls for the same <target> append items in the order called."
  65. "If SYSTEM is specified, the compiler will be told the "
  66. "directories are meant as system include directories on some "
  67. "platforms (signalling this setting might achieve effects such as "
  68. "the compiler skipping warnings, or these fixed-install system files "
  69. "not being considered in dependency calculations - see compiler "
  70. "docs). If SYSTEM is used together with PUBLIC or INTERFACE, the "
  71. "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property will be "
  72. "populated with the specified directories."
  73. "\n"
  74. "Arguments to target_include_directories may use \"generator "
  75. "expressions\" with the syntax \"$<...>\". "
  76. CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
  77. CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
  78. ;
  79. }
  80. cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase);
  81. private:
  82. virtual void HandleImportedTarget(const std::string &tgt);
  83. virtual void HandleMissingTarget(const std::string &name);
  84. virtual void HandleDirectContent(cmTarget *tgt,
  85. const std::vector<std::string> &content,
  86. bool prepend, bool system);
  87. virtual void HandleInterfaceContent(cmTarget *tgt,
  88. const std::vector<std::string> &content,
  89. bool prepend, bool system);
  90. virtual std::string Join(const std::vector<std::string> &content);
  91. };
  92. #endif