cmAddSubDirectoryCommand.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 this subdirectory "
  72. "will not be included in build by default. Users will have to "
  73. "explicitly start a build in the generated output directory. "
  74. "This is useful for having cmake create a build system for a "
  75. "set of examples in a project. One would want cmake to generate "
  76. "a single build system for all the examples, but one may not want "
  77. "the targets to show up in the main build system.";
  78. }
  79. cmTypeMacro(cmAddSubDirectoryCommand, cmCommand);
  80. };
  81. #endif