cmIncludeCommand.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 cmIncludeCommand_h
  11. #define cmIncludeCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmIncludeCommand
  14. * \brief
  15. *
  16. * cmIncludeCommand defines a list of distant
  17. * files that can be "included" in the current list file.
  18. * In almost every sense, this is identical to a C/C++
  19. * #include command. Arguments are first expended as usual.
  20. */
  21. class cmIncludeCommand : public cmCommand
  22. {
  23. public:
  24. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. virtual cmCommand* Clone()
  28. {
  29. return new cmIncludeCommand;
  30. }
  31. /**
  32. * This is called when the command is first encountered in
  33. * the CMakeLists.txt file.
  34. */
  35. virtual bool InitialPass(std::vector<std::string> const& args,
  36. cmExecutionStatus &status);
  37. /**
  38. * This determines if the command is invoked when in script mode.
  39. */
  40. virtual bool IsScriptable() { return true; }
  41. /**
  42. * The name of the command as specified in CMakeList.txt.
  43. */
  44. virtual const char* GetName() {return "include";}
  45. /**
  46. * Succinct documentation.
  47. */
  48. virtual const char* GetTerseDocumentation()
  49. {
  50. return "Read CMake listfile code from the given file.";
  51. }
  52. /**
  53. * More documentation.
  54. */
  55. virtual const char* GetFullDocumentation()
  56. {
  57. return
  58. " include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]\n"
  59. " [NO_POLICY_SCOPE])\n"
  60. "Reads CMake listfile code from the given file. Commands in the file "
  61. "are processed immediately as if they were written in place of the "
  62. "include command. If OPTIONAL is present, then no error "
  63. "is raised if the file does not exist. If RESULT_VARIABLE is given "
  64. "the variable will be set to the full filename which "
  65. "has been included or NOTFOUND if it failed.\n"
  66. "If a module is specified instead of a file, the file with name "
  67. "<modulename>.cmake is searched first in CMAKE_MODULE_PATH, then in the "
  68. "CMake module directory. There is one exception to this: if the file "
  69. "which calls include() is located itself in the CMake module directory, "
  70. "then first the CMake module directory is searched and "
  71. "CMAKE_MODULE_PATH afterwards. See also policy CMP0017."
  72. "\n"
  73. "See the cmake_policy() command documentation for discussion of the "
  74. "NO_POLICY_SCOPE option."
  75. ;
  76. }
  77. cmTypeMacro(cmIncludeCommand, cmCommand);
  78. };
  79. #endif