cmAddSubDirectoryCommand.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmAddSubDirectoryCommand_h
  14. #define cmAddSubDirectoryCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmAddSubDirectoryCommand
  17. * \brief Specify a subdirectory to build
  18. *
  19. * cmAddSubDirectoryCommand specifies a subdirectory to process
  20. * by CMake. CMake will descend
  21. * into the specified source directory and process any CMakeLists.txt found.
  22. */
  23. class cmAddSubDirectoryCommand : public cmCommand
  24. {
  25. public:
  26. /**
  27. * This is a virtual constructor for the command.
  28. */
  29. virtual cmCommand* Clone()
  30. {
  31. return new cmAddSubDirectoryCommand;
  32. }
  33. /**
  34. * This is called when the command is first encountered in
  35. * the CMakeLists.txt file.
  36. */
  37. virtual bool InitialPass(std::vector<std::string> const& args,
  38. cmExecutionStatus &status);
  39. /**
  40. * The name of the command as specified in CMakeList.txt.
  41. */
  42. virtual const char* GetName() { return "add_subdirectory";}
  43. /**
  44. * Succinct documentation.
  45. */
  46. virtual const char* GetTerseDocumentation()
  47. {
  48. return "Add a subdirectory to the build.";
  49. }
  50. /**
  51. * More documentation.
  52. */
  53. virtual const char* GetFullDocumentation()
  54. {
  55. return
  56. " add_subdirectory(source_dir [binary_dir] \n"
  57. " [EXCLUDE_FROM_ALL])\n"
  58. "Add a subdirectory to the build. The source_dir specifies the "
  59. "directory in which the source CmakeLists.txt and code files are "
  60. "located. If it is a relative "
  61. "path it will be evaluated with respect to the current "
  62. "directory (the typical usage), but it may also be an absolute path. "
  63. "The binary_dir specifies the directory in which to place the output "
  64. "files. If it is a relative path it will be evaluated with respect "
  65. "to the current output directory, but it may also be an absolute "
  66. "path. If binary_dir is not specified, the value of source_dir, "
  67. "before expanding any relative path, will be used (the typical usage). "
  68. "The CMakeLists.txt file in the specified source directory will "
  69. "be processed immediately by CMake before processing in the current "
  70. "input file continues beyond this command.\n"
  71. "If the EXCLUDE_FROM_ALL argument is provided then targets in the "
  72. "subdirectory will not be included in the ALL target of the parent "
  73. "directory by default, and will be excluded from IDE project files. "
  74. "Users must explicitly build targets in the subdirectory. "
  75. "This is meant for use when the subdirectory contains a separate part "
  76. "of the project that is useful but not necessary, such as a set of "
  77. "examples. "
  78. "Typically the subdirectory should contain its own project() command "
  79. "invocation so that a full build system will be generated in the "
  80. "subdirectory (such as a VS IDE solution file). "
  81. "Note that inter-target dependencies supercede this exclusion. "
  82. "If a target built by the parent project depends on a target in the "
  83. "subdirectory, the dependee target will be included in the parent "
  84. "project build system to satisfy the dependency."
  85. ;
  86. }
  87. cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
  88. };
  89. #endif