cetmodules-project-variables(7)¶
Within Cetmodules, a project variable <pvar>
refers to a CMake
cache variable <project-name>_<pvar>
created by the function
project_variable()
. A project variable may have
property
-like
attributes with it that may be interrogated, set or altered. In
addition, project variables may be propagated to dependent packages via
the project’s CMake config file as generated by
cet_cmake_config()
along with appropriate treatment for path or
file-like values in the context of the installed package.
Project Variable Type
¶
As they are CMake CACHE
variables, project variables
have a type. However, project variables have two additional types:
FILEPATH_FRAGMENT
and PATH_FRAGMENT
. These types are similar to
their non-_FRAGMENT
equivalents, but are considered to be relative
to a project’s top level source directory, binary directory, or install
prefix, depending on context.
Architecture-Specific Project Variables¶
Project variables of type FILEPATH_FRAGMENT
or PATH_FRAGMENT
may
be architecture specific according to their <var-name>
as determined
by:
Cetmodules’ defaults as defined by
CETMODULES_DEFAULT_ARCH_DIRS
.<PROJECT-NAME>_ADD_ARCH_DIRS
and<PROJECT-NAME>_ADD_NOARCH_DIRS
.
The initial value of relative architecture-specific project variables as
determined by project_variable()
will have
${CETMODULES_CURRENT_PROJECT_NAME}_EXEC_PREFIX
prepended to their value if defined.
Project Variable Properties¶
Several property
-like attributes may be
defined for project variables by project_variable()
and
interrogated via cet_get_pv_property()
, and more may be set by
the user via cet_set_pv_property()
. These are not CMake
properties in the formal sense, but are semantically similar and stored
in CMake’s cache.
Properties defined by project_variable()
¶
CONFIG
,MISSING_OK
,OMIT_IF_EMPTY
,OMIT_IF_MISSING
,OMIT_IF_NULL
Boolean proprties indicating whether the corresponding option was specified to
project_variable()
.IS_PATH
TRUE
if the variable should be treated as the location of a file or directory in the filesystem.ORIGIN
The origin of the initial value of the project variable, following the defined order of precedence. Valid values are:
The name of the variable from which the initial value was taken.
<initial-value>
<backup-default>
TYPE
The defined type of the project variable. Valid values are the
CMake CACHE variable types
, plusFILEPATH_FRAGMENT
andPATH_FRAGMENT
.
Project Variables and CMake Config files¶
Any project variable defined with the CONFIG
attribute will be
propagated to dependent packages: a suitable definition will be
generated in <PROJECT-NAME>Config.cmake
by the
cet_cmake_config()
function. In the case of project variables
of type (FILE)?PATH(_FRAGMENT)?
, the path will be localized
appropriately for the package’s installation location. Additional
attributes (MISSING_OK,
OMIT_IF_EMPTY,
OMIT_IF_MISSING,
OMIT_IF_NULL) modify the details of that
definition.