cmAddSubDirectoryCommand.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 cmAddSubDirectoryCommand_h
  11. #define cmAddSubDirectoryCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmAddSubDirectoryCommand
  14. * \brief Specify a subdirectory to build
  15. *
  16. * cmAddSubDirectoryCommand specifies a subdirectory to process
  17. * by CMake. CMake will descend
  18. * into the specified source directory and process any CMakeLists.txt found.
  19. */
  20. class cmAddSubDirectoryCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmAddSubDirectoryCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args,
  35. cmExecutionStatus &status);
  36. /**
  37. * The name of the command as specified in CMakeList.txt.
  38. */
  39. virtual const char* GetName() const { return "add_subdirectory";}
  40. /**
  41. * Succinct documentation.
  42. */
  43. virtual const char* GetTerseDocumentation() const
  44. {
  45. return "Add a subdirectory to the build.";
  46. }
  47. /**
  48. * More documentation.
  49. */
  50. virtual const char* GetFullDocumentation() const
  51. {
  52. return
  53. " add_subdirectory(source_dir [binary_dir] \n"
  54. " [EXCLUDE_FROM_ALL])\n"
  55. "Add a subdirectory to the build. The source_dir specifies the "
  56. "directory in which the source CmakeLists.txt and code files are "
  57. "located. If it is a relative "
  58. "path it will be evaluated with respect to the current "
  59. "directory (the typical usage), but it may also be an absolute path. "
  60. "The binary_dir specifies the directory in which to place the output "
  61. "files. If it is a relative path it will be evaluated with respect "
  62. "to the current output directory, but it may also be an absolute "
  63. "path. If binary_dir is not specified, the value of source_dir, "
  64. "before expanding any relative path, will be used (the typical usage). "
  65. "The CMakeLists.txt file in the specified source directory will "
  66. "be processed immediately by CMake before processing in the current "
  67. "input file continues beyond this command.\n"
  68. "If the EXCLUDE_FROM_ALL argument is provided then targets in the "
  69. "subdirectory will not be included in the ALL target of the parent "
  70. "directory by default, and will be excluded from IDE project files. "
  71. "Users must explicitly build targets in the subdirectory. "
  72. "This is meant for use when the subdirectory contains a separate part "
  73. "of the project that is useful but not necessary, such as a set of "
  74. "examples. "
  75. "Typically the subdirectory should contain its own project() command "
  76. "invocation so that a full build system will be generated in the "
  77. "subdirectory (such as a VS IDE solution file). "
  78. "Note that inter-target dependencies supercede this exclusion. "
  79. "If a target built by the parent project depends on a target in the "
  80. "subdirectory, the dependee target will be included in the parent "
  81. "project build system to satisfy the dependency."
  82. ;
  83. }
  84. cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
  85. };
  86. #endif