cmAuxSourceDirectoryCommand.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 cmAuxSourceDirectoryCommand_h
  11. #define cmAuxSourceDirectoryCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmAuxSourceDirectoryCommand
  14. * \brief Specify auxiliary source code directories.
  15. *
  16. * cmAuxSourceDirectoryCommand specifies source code directories
  17. * that must be built as part of this build process. This directories
  18. * are not recursively processed like the SUBDIR command (cmSubdirCommand).
  19. * A side effect of this command is to create a subdirectory in the build
  20. * directory structure.
  21. */
  22. class cmAuxSourceDirectoryCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmAuxSourceDirectoryCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool InitialPass(std::vector<std::string> const& args,
  37. cmExecutionStatus &status);
  38. /**
  39. * The name of the command as specified in CMakeList.txt.
  40. */
  41. virtual const char* GetName() { return "aux_source_directory";}
  42. /**
  43. * Succinct documentation.
  44. */
  45. virtual const char* GetTerseDocumentation()
  46. {
  47. return "Find all source files in a directory.";
  48. }
  49. /**
  50. * More documentation.
  51. */
  52. virtual const char* GetFullDocumentation()
  53. {
  54. return
  55. " aux_source_directory(<dir> <variable>)\n"
  56. "Collects the names of all the source files in the specified "
  57. "directory and stores the list in the <variable> provided. This "
  58. "command is intended to be used by projects that use explicit "
  59. "template instantiation. Template instantiation files can be "
  60. "stored in a \"Templates\" subdirectory and collected automatically "
  61. "using this command to avoid manually listing all instantiations.\n"
  62. "It is tempting to use this command to avoid writing the list of "
  63. "source files for a library or executable target. While this seems "
  64. "to work, there is no way for CMake to generate a build system that "
  65. "knows when a new source file has been added. Normally the "
  66. "generated build system knows when it needs to rerun CMake because "
  67. "the CMakeLists.txt file is modified to add a new source. When the "
  68. "source is just added to the directory without modifying this file, "
  69. "one would have to manually rerun CMake to generate a build system "
  70. "incorporating the new file.";
  71. }
  72. cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand);
  73. };
  74. #endif