加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
source.rst 2.39 KB
一键复制 编辑 原始数据 按行查看 历史

CMake Source Code Guide

The following is a guide to the CMake source code for developers. See documentation on CMake Development for more information.

C++ Code Style

We use clang-format version 6.0 to define our style for C++ code in the CMake source tree. See the .clang-format configuration file for our style settings. Use the Utilities/Scripts/clang-format.bash script to format source code. It automatically runs clang-format on the set of source files for which we enforce style. The script also has options to format only a subset of files, such as those that are locally modified.

C++ Subset Permitted

CMake requires compiling as C++11 or above. However, in order to support building on older toolchains some constructs need to be handled with care:

  • Do not use std::auto_ptr.

    The std::auto_ptr template is deprecated in C++11. Use std::unique_ptr.

Source Tree Layout

The CMake source tree is organized as follows.

  • Auxiliary/: Shell and editor integration files.
  • Help/: Documentation. See the CMake Documentation Guide.
    • Help/dev/: Developer documentation.
    • Help/release/dev/: Release note snippets for development since last release.
  • Licenses/: License files for third-party libraries in binary distributions.
  • Modules/: CMake language modules installed with CMake.
  • Packaging/: Files used for packaging CMake itself for distribution.
  • Source/: Source code of CMake itself.
  • Templates/: Files distributed with CMake as implementation details for generators, packagers, etc.
  • Tests/: The test suite. See Tests/README.rst.
  • Utilities/: Scripts, third-party source code.
    • Utilities/Sphinx/: Sphinx configuration to build CMake user documentation.
    • Utilities/Release/: Scripts used to package CMake itself for distribution on cmake.org. See Utilities/Release/README.rst.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化