source.rst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. CMake Source Code Guide
  2. ***********************
  3. The following is a guide to the CMake source code for developers.
  4. See documentation on `CMake Development`_ for more information.
  5. .. _`CMake Development`: README.rst
  6. C++ Code Style
  7. ==============
  8. We use `clang-format`_ version **6.0** to define our style for C++ code in
  9. the CMake source tree. See the `.clang-format`_ configuration file for our
  10. style settings. Use the `Utilities/Scripts/clang-format.bash`_ script to
  11. format source code. It automatically runs ``clang-format`` on the set of
  12. source files for which we enforce style. The script also has options to
  13. format only a subset of files, such as those that are locally modified.
  14. .. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
  15. .. _`.clang-format`: ../../.clang-format
  16. .. _`Utilities/Scripts/clang-format.bash`: ../../Utilities/Scripts/clang-format.bash
  17. C++ Subset Permitted
  18. ====================
  19. CMake requires compiling as C++11 or above. However, in order to support
  20. building on older toolchains some constructs need to be handled with care:
  21. * Do not use ``std::auto_ptr``.
  22. The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
  23. Source Tree Layout
  24. ==================
  25. The CMake source tree is organized as follows.
  26. * ``Auxiliary/``:
  27. Shell and editor integration files.
  28. * ``Help/``:
  29. Documentation. See the `CMake Documentation Guide`_.
  30. * ``Help/dev/``:
  31. Developer documentation.
  32. * ``Help/release/dev/``:
  33. Release note snippets for development since last release.
  34. * ``Licenses/``:
  35. License files for third-party libraries in binary distributions.
  36. * ``Modules/``:
  37. CMake language modules installed with CMake.
  38. * ``Packaging/``:
  39. Files used for packaging CMake itself for distribution.
  40. * ``Source/``:
  41. Source code of CMake itself.
  42. * ``Templates/``:
  43. Files distributed with CMake as implementation details for generators,
  44. packagers, etc.
  45. * ``Tests/``:
  46. The test suite. See `Tests/README.rst`_.
  47. * ``Utilities/``:
  48. Scripts, third-party source code.
  49. * ``Utilities/Sphinx/``:
  50. Sphinx configuration to build CMake user documentation.
  51. * ``Utilities/Release/``:
  52. Scripts used to package CMake itself for distribution on ``cmake.org``.
  53. See `Utilities/Release/README.rst`_.
  54. .. _`CMake Documentation Guide`: documentation.rst
  55. .. _`Tests/README.rst`: ../../Tests/README.rst
  56. .. _`Utilities/Release/README.rst`: ../../Utilities/Release/README.rst