ProjectVariable¶
Utilities for defining and manipulating project-specific cache variables.
Defined functions:
project_variable()Define a
project variable: a project-specific cache variable with optional propagation to dependent packages viafind_package().cet_get_pv_property()Get the value of a
property-like attribute attached to a particularproject variable.cet_set_pv_property()Set or add to a
property-like attribute attached to a particularproject variable.
See also
cet_localize_pv(), cet_localize_pv_all(),
cet_cmake_config().
- cet_get_pv_property¶
Get the value of a
property-like attribute attached to a particularproject variable.cet_get_pv_property([<out-var>] [PROJECT] <project-name> <var-name> PROPERTY <property>)
Options¶
[PROJECT] <project-name>Find project variable
<var-name>in project<project-name>(default${CETMODULES_CURRENT_PROJECT_NAME}). If<out-var>is specified, thePROJECTkeyword is optional.PROPERTY <property>The property-like attribute of project variable
<var-name>whose value(s) should be returned in<out-var>.
Non-option arguments¶
[<out-var>]The variable in which the value(s) of project variable
<var-name>in project<project-name>shall be returned. If not specified, the property’s values shall be returned in a variable in caller’s scope whose name is<property>.
- cet_set_pv_property¶
Set or append values to a
property-like attribute attached to a particularproject variable.cet_set_pv_property([<project-name>] <var-name> [APPEND|APPEND_STRING] PROPERTY <property> [<value> ...])
Options¶
PROPERTY <property>The property-like attribute of project variable
<var-name>whose value(s) should be returned in<out-var>.APPEND<property>shall be treated as alistfor the purposes of appending<value> ....APPEND_STRING<property>shall be treated as astringfor the purposes of appending<value> ....
Non-option arguments¶
<project-name>Find project variable
<var-name>in project<project-name>(default${CETMODULES_CURRENT_PROJECT_NAME}).<value> ...The item(s) to be set for or appended to
<property>.
- project_variable¶
Define a project-specific cache variable
${CETMODULES_CURRENT_PROJECT_NAME}_<var-name>, extending the functionality ofset(... CACHE ...). Optionally ensure that the variable is appropriately defined for dependents viafind_package().See also
project_variable(<var-name> [<options>] [<init-val> ...])
Options¶
BACKUP_DEFAULT <default-val> ...If
<init-val>evaluates toFALSEthen<default-val> ...will be the initial value of the cached variable.
CONFIGAdd the defined project variable to
${CETMODULES_CURRENT_PROJECT_NAME}Config.cmakefor propagation to dependent packages—in a location-independent way if appropriate to the variable’s TYPE—viafind_package().DOCSTRING <docstring>A string describing the variable (defaults to a generic description).
MISSING_OKA project variable whose TYPE matches
^(FILE)?PATH(_FRAGMENT)?$but whose value does not represent a valid path in the installation area will cause an error atfind_package()-time unless this option is specified.NO_WARN_DUPLICATEDo not warn about multiple attempts to define the same project variable in the same project.
NO_WARN_REDUNDANTDo not warn about redundant options (e.g. if
CONFIGis not specified).
OMIT_IF_EMPTYIf specified, a project variable representing a directory (i.e. whose TYPE matches
^PATH(_FRAGMENT)?$) will be omitted from${CETMODULES_CURRENT_PROJECT_NAME}Config.cmakeif it contains no entries other than.and..
OMIT_IF_MISSINGIf specified, a project variable whose TYPE matches
^(FILE)?PATH(_FRAGMENT)?$but whose value does not represent an existing file or directory in the installation area will be omitted from${CETMODULES_CURRENT_PROJECT_NAME}Config.cmake.
OMIT_IF_NULLIf specified, the definition of a vacuous project variable will be omitted from
${CETMODULES_CURRENT_PROJECT_NAME}Config.cmake.PUBLICProject variables will generally be marked “advanced”—not visible by default in CMake configuration GUIs or to
cmake -N-Lin the absence of the-Aoption. SpecifyingPUBLICwill negate this.See also
TYPE <type>Define the `project-variables-types`_ type of the project variable (default
PATH_FRAGMENT).Non-option arguments¶
<var-name>The name of the cached variable will be
${CETMODULES_CURRENT_PROJECT_NAME}_<var-name><init-val> ...The initial value(s) of the cached variable.
Details¶
Order of precedence for the initial value of
${CETMODULES_CURRENT_PROJECT_NAME}_<var-name>:The value of a CMake variable
${CETMODULES_CURRENT_PROJECT_NAME}_<var-name>if it is defined in the current scope (that in whichproject_variable()is called) prior to the definition of the project variable.The value of a CMake variable
<var-name>if it is defined in the current scope prior to the definition of the project variable.The value of a CMake or cached variable
${CETMODULES_CURRENT_PROJECT_VARIABLE_PREFIX}_<var-name>.The value of a CMake or cached variable
${CETMODULES_CURRENT_PROJECT_NAME}_<var-name>_INIT.<init-val> ....<backup-var> ...if specified and<init-val> ...evaluates toFALSE).
Cetmodules