Modules

SUNDIALS defines several custom CMake functions and macros to simplify common tasks in the build system, such as adding options or creating libraries.

SundialsOption

This module provides a command for setting SUNDIALS cache variables (configuration options).

Load this module in with:

include(SundialsOption)

Commands

This module provides the following command:

sundials_option

Set a SUNDIALS cache variable (configuration option) to a given value.

sundials_option(<variable> <type> <help string> <default value>
                [ADVANCED]
                [OPTIONS options]
                [DEPENDS_ON dependencies]
                [DEPENDS_ON_THROW_ERROR]
                [DEPRECATED_NAMES names]
                [NEGATE_DEPRECATED])

Wraps the CMake set() command to set the given cache variable.

The arguments are:

<variable>

The name of a variable that stores the option value.

<type>

The type of the cache entry.

<help string>

Text providing a quick summary of the option for CMake GUIs.

<default value>

The default value for the cache variable.

  • If the cache entry does not exist prior to the call, then it will be set to the default value.

The options are:

ADVANCED

Mark the cache variable as advanced.

OPTIONS <options>...

A list of valid values for the cache variable.

  • If a user set the variable to a value not in the list of options, the configuration is halted and an error message is printed.

DEPENDS_ON <dependencies>...

A list of variables which must evaluate to true for the cache variable to be set.

  • If any of the dependencies evaluate to false, then the cache variable will be unset and a warning message is printed.

DEPENDS_ON_THROW_ERROR

Throw an error if the option dependencies are not met.

DEPRECATED_NAMES <variables>...

A list of deprecated cache variable names for the cache variable.

  • If the cache variable is already defined and any of the deprecated cache variables are also defined, the deprecated variables are ignored and a warning message is printed.

  • If the cache variable is not defined and a deprecated cache variable is defined, the value of the deprecated variable is copied to the cache variable and a warning message is printed.

  • If multiple deprecated cache variable names are provided and more than one of them is defined, an error is printed if the deprecated variables do not all have the same value.

  • If SUNDIALS_ENABLE_UNSET_DEPRECATED is true, any deprecated variables will be unset after checking the value for the cases above.

NEGATE_DEPRECATED

Negate the value of deprecated boolean cache variables when setting a cache variable that is not already defined.