Style

In this section we describe the CMake style conventions and guidelines for SUNDIALS.

Naming

SUNDIALS CMake cache variables (configuration options) must adhere to the following naming conventions:

  1. To avoid naming collisions with other projects that include SUNDIALS as part of their CMake build system, SUNDIALS CMake cache variables are prefixed with SUNDIALS_.

  2. Boolean options are prefixed with SUNDIALS_ENABLE_.

  3. Cache variables use screaming snake case, SUNDIALS_OPTION_NAME.

  4. Options to enable third party libraries are named SUNDIALS_ENABLE_LIBRARY_NAME.

  5. The SUNDIALS_ prefix may be followed by a category name for grouping related options, SUNDIALS_CATEGORY_OPTION_NAME. For example,

    • SUNDIALS_TEST_ for SUNDIALS testing options

    • SUNDIALS_EXAMPLES_ for options related to the SUNDIALS examples

    • SUNDIALS_BENCHMARKS_ for options related to SUNDIALS benchmarks

    • SUNDIALS_DEV_ for development options

    • SUNDIALS_DEBUG_ for debugging options

Formatting

CMake files should be formatted with cmake-format. cmake-format can be installed with pip:

pip install cmake-format

Individual files can be formatted with the command:

cmake-format -i <cmake file>

The .cmake-format.py file in the root of the project defines our configuration for cmake-format.