cmIncludeDirectoryCommand.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  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 cmIncludeDirectoryCommand_h
  11. #define cmIncludeDirectoryCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmIncludeDirectoryCommand
  14. * \brief Add include directories to the build.
  15. *
  16. * cmIncludeDirectoryCommand is used to specify directory locations
  17. * to search for included files.
  18. */
  19. class cmIncludeDirectoryCommand : public cmCommand
  20. {
  21. public:
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. virtual cmCommand* Clone()
  26. {
  27. return new cmIncludeDirectoryCommand;
  28. }
  29. /**
  30. * This is called when the command is first encountered in
  31. * the CMakeLists.txt file.
  32. */
  33. virtual bool InitialPass(std::vector<std::string> const& args,
  34. cmExecutionStatus &status);
  35. /**
  36. * The name of the command as specified in CMakeList.txt.
  37. */
  38. virtual const char* GetName() const { return "include_directories";}
  39. /**
  40. * Succinct documentation.
  41. */
  42. virtual const char* GetTerseDocumentation() const
  43. {
  44. return "Add include directories to the build.";
  45. }
  46. /**
  47. * More documentation.
  48. */
  49. virtual const char* GetFullDocumentation() const
  50. {
  51. return
  52. " include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n"
  53. "Add the given directories to those the compiler uses to search "
  54. "for include files. Relative paths are interpreted as relative to "
  55. "the current source directory. \n"
  56. "The include directories are added to the directory property "
  57. "INCLUDE_DIRECTORIES for the current CMakeLists file. "
  58. "They are also added to the target property INCLUDE_DIRECTORIES "
  59. "for each target in the current CMakeLists file. "
  60. "The target property values are the ones used by the generators."
  61. "\n"
  62. "By default the directories are appended onto the current list of "
  63. "directories. "
  64. "This default behavior can be changed by setting "
  65. "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
  66. "By using AFTER or BEFORE explicitly, you can select between "
  67. "appending and prepending, independent of the default. "
  68. "\n"
  69. "If the SYSTEM option is given, the compiler will be told the "
  70. "directories are meant as system include directories on some "
  71. "platforms (signalling this setting might achieve effects such as "
  72. "the compiler skipping warnings, or these fixed-install system files "
  73. "not being considered in dependency calculations - see compiler docs).";
  74. }
  75. cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);
  76. protected:
  77. // used internally
  78. void GetIncludes(const std::string &arg, std::vector<std::string> &incs);
  79. void NormalizeInclude(std::string &inc);
  80. };
  81. #endif