How it works

The option command accepts three arguments:

 option(<option_variable> "help string" [initial value])
  • <option_variable> is the name of variable representing the option.
  • "help string" is a string documenting the option. This documentation becomes visible in terminal-based or graphical user interfaces for CMake.
  • [initial value] is the default value for the option, either ON or OFF.

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.