Table of Contents

CMake Guidelines

We expect that all CMake scripts that are either:

should follow the guidelines laid out in this document. Existing scripts may not follow these guidelines yet; it is expected that we will continue to update old scripts to fall in line with these guidelines.

These guidelines are intended to create stability in our scripts. We hope that they will make both forwards and backwards compatibility easier.

The Guidelines

  function(format out_var)
    cmake_parse_arguments(PARSE_ARGV 1 "arg" ...)
    # ... set(buffer "output")
    set("${out_var}" "${buffer}" PARENT_SCOPE)
  if("${start}" LESS_EQUAL "${end}")
    foreach(RANGE "${start}" "${end}")

CMake Versions to Require

Changing Existing Functions

Naming Variables