Help: Convert genex documentation to sphinx domain objects

This makes them linkable, indexed, and enables cross-references.
This commit is contained in:
Brad King
2021-01-15 22:15:32 -05:00
parent 778321beb4
commit c2dc7e0f53

View File

@@ -46,7 +46,8 @@ Available boolean expressions are:
Logical Operators Logical Operators
----------------- -----------------
``$<BOOL:string>`` .. genex:: $<BOOL:string>
Converts ``string`` to ``0`` or ``1``. Evaluates to ``0`` if any of the Converts ``string`` to ``0`` or ``1``. Evaluates to ``0`` if any of the
following is true: following is true:
@@ -57,23 +58,27 @@ Logical Operators
Otherwise evaluates to ``1``. Otherwise evaluates to ``1``.
``$<AND:conditions>`` .. genex:: $<AND:conditions>
where ``conditions`` is a comma-separated list of boolean expressions. where ``conditions`` is a comma-separated list of boolean expressions.
Evaluates to ``1`` if all conditions are ``1``. Evaluates to ``1`` if all conditions are ``1``.
Otherwise evaluates to ``0``. Otherwise evaluates to ``0``.
``$<OR:conditions>`` .. genex:: $<OR:conditions>
where ``conditions`` is a comma-separated list of boolean expressions. where ``conditions`` is a comma-separated list of boolean expressions.
Evaluates to ``1`` if at least one of the conditions is ``1``. Evaluates to ``1`` if at least one of the conditions is ``1``.
Otherwise evaluates to ``0``. Otherwise evaluates to ``0``.
``$<NOT:condition>`` .. genex:: $<NOT:condition>
``0`` if ``condition`` is ``1``, else ``1``. ``0`` if ``condition`` is ``1``, else ``1``.
String Comparisons String Comparisons
------------------ ------------------
``$<STREQUAL:string1,string2>`` .. genex:: $<STREQUAL:string1,string2>
``1`` if ``string1`` and ``string2`` are equal, else ``0``. ``1`` if ``string1`` and ``string2`` are equal, else ``0``.
The comparison is case-sensitive. For a case-insensitive comparison, The comparison is case-sensitive. For a case-insensitive comparison,
combine with a :ref:`string transforming generator expression combine with a :ref:`string transforming generator expression
@@ -83,100 +88,150 @@ String Comparisons
$<STREQUAL:$<UPPER_CASE:${foo}>,"BAR"> # "1" if ${foo} is any of "BAR", "Bar", "bar", ... $<STREQUAL:$<UPPER_CASE:${foo}>,"BAR"> # "1" if ${foo} is any of "BAR", "Bar", "bar", ...
``$<EQUAL:value1,value2>`` .. genex:: $<EQUAL:value1,value2>
``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``. ``1`` if ``value1`` and ``value2`` are numerically equal, else ``0``.
``$<IN_LIST:string,list>``
.. genex:: $<IN_LIST:string,list>
``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``. ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``.
Uses case-sensitive comparisons. Uses case-sensitive comparisons.
``$<VERSION_LESS:v1,v2>``
.. genex:: $<VERSION_LESS:v1,v2>
``1`` if ``v1`` is a version less than ``v2``, else ``0``. ``1`` if ``v1`` is a version less than ``v2``, else ``0``.
``$<VERSION_GREATER:v1,v2>``
.. genex:: $<VERSION_GREATER:v1,v2>
``1`` if ``v1`` is a version greater than ``v2``, else ``0``. ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
``$<VERSION_EQUAL:v1,v2>``
.. genex:: $<VERSION_EQUAL:v1,v2>
``1`` if ``v1`` is the same version as ``v2``, else ``0``. ``1`` if ``v1`` is the same version as ``v2``, else ``0``.
``$<VERSION_LESS_EQUAL:v1,v2>``
.. genex:: $<VERSION_LESS_EQUAL:v1,v2>
``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``. ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
``$<VERSION_GREATER_EQUAL:v1,v2>``
.. genex:: $<VERSION_GREATER_EQUAL:v1,v2>
``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``. ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
Variable Queries Variable Queries
---------------- ----------------
``$<TARGET_EXISTS:target>`` .. genex:: $<TARGET_EXISTS:target>
``1`` if ``target`` exists, else ``0``. ``1`` if ``target`` exists, else ``0``.
``$<CONFIG:cfgs>``
.. genex:: $<CONFIG:cfgs>
``1`` if config is any one of the entries in ``cfgs``, else ``0``. This is a ``1`` if config is any one of the entries in ``cfgs``, else ``0``. This is a
case-insensitive comparison. The mapping in case-insensitive comparison. The mapping in
:prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by this :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by this
expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` expression when it is evaluated on a property on an :prop_tgt:`IMPORTED`
target. target.
``$<PLATFORM_ID:platform_ids>``
.. genex:: $<PLATFORM_ID:platform_ids>
where ``platform_ids`` is a comma-separated list. where ``platform_ids`` is a comma-separated list.
``1`` if the CMake's platform id matches any one of the entries in ``1`` if the CMake's platform id matches any one of the entries in
``platform_ids``, otherwise ``0``. ``platform_ids``, otherwise ``0``.
See also the :variable:`CMAKE_SYSTEM_NAME` variable. See also the :variable:`CMAKE_SYSTEM_NAME` variable.
``$<C_COMPILER_ID:compiler_ids>``
.. genex:: $<C_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the C compiler matches any one ``1`` if the CMake's compiler id of the C compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<CXX_COMPILER_ID:compiler_ids>``
.. genex:: $<CXX_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the CXX compiler matches any one ``1`` if the CMake's compiler id of the CXX compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<CUDA_COMPILER_ID:compiler_ids>``
.. genex:: $<CUDA_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the CUDA compiler matches any one ``1`` if the CMake's compiler id of the CUDA compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<OBJC_COMPILER_ID:compiler_ids>``
.. genex:: $<OBJC_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Objective-C compiler matches any one ``1`` if the CMake's compiler id of the Objective-C compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<OBJCXX_COMPILER_ID:compiler_ids>``
.. genex:: $<OBJCXX_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Objective-C++ compiler matches any one ``1`` if the CMake's compiler id of the Objective-C++ compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<Fortran_COMPILER_ID:compiler_ids>``
.. genex:: $<Fortran_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the Fortran compiler matches any one ``1`` if the CMake's compiler id of the Fortran compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<ISPC_COMPILER_ID:compiler_ids>``
.. genex:: $<ISPC_COMPILER_ID:compiler_ids>
where ``compiler_ids`` is a comma-separated list. where ``compiler_ids`` is a comma-separated list.
``1`` if the CMake's compiler id of the ISPC compiler matches any one ``1`` if the CMake's compiler id of the ISPC compiler matches any one
of the entries in ``compiler_ids``, otherwise ``0``. of the entries in ``compiler_ids``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<C_COMPILER_VERSION:version>``
.. genex:: $<C_COMPILER_VERSION:version>
``1`` if the version of the C compiler matches ``version``, otherwise ``0``. ``1`` if the version of the C compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<CXX_COMPILER_VERSION:version>``
.. genex:: $<CXX_COMPILER_VERSION:version>
``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``. ``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<CUDA_COMPILER_VERSION:version>``
.. genex:: $<CUDA_COMPILER_VERSION:version>
``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``. ``1`` if the version of the CXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<OBJC_COMPILER_VERSION:version>``
.. genex:: $<OBJC_COMPILER_VERSION:version>
``1`` if the version of the OBJC compiler matches ``version``, otherwise ``0``. ``1`` if the version of the OBJC compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<OBJCXX_COMPILER_VERSION:version>``
.. genex:: $<OBJCXX_COMPILER_VERSION:version>
``1`` if the version of the OBJCXX compiler matches ``version``, otherwise ``0``. ``1`` if the version of the OBJCXX compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<Fortran_COMPILER_VERSION:version>``
.. genex:: $<Fortran_COMPILER_VERSION:version>
``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``. ``1`` if the version of the Fortran compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<ISPC_COMPILER_VERSION:version>``
.. genex:: $<ISPC_COMPILER_VERSION:version>
``1`` if the version of the ISPC compiler matches ``version``, otherwise ``0``. ``1`` if the version of the ISPC compiler matches ``version``, otherwise ``0``.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<TARGET_POLICY:policy>``
.. genex:: $<TARGET_POLICY:policy>
``1`` if the ``policy`` was NEW when the 'head' target was created, ``1`` if the ``policy`` was NEW when the 'head' target was created,
else ``0``. If the ``policy`` was not set, the warning message for the policy else ``0``. If the ``policy`` was not set, the warning message for the policy
will be emitted. This generator expression only works for a subset of will be emitted. This generator expression only works for a subset of
policies. policies.
``$<COMPILE_FEATURES:features>``
.. genex:: $<COMPILE_FEATURES:features>
where ``features`` is a comma-spearated list. where ``features`` is a comma-spearated list.
Evaluates to ``1`` if all of the ``features`` are available for the 'head' Evaluates to ``1`` if all of the ``features`` are available for the 'head'
target, and ``0`` otherwise. If this expression is used while evaluating target, and ``0`` otherwise. If this expression is used while evaluating
@@ -188,7 +243,8 @@ Variable Queries
.. _`Boolean COMPILE_LANGUAGE Generator Expression`: .. _`Boolean COMPILE_LANGUAGE Generator Expression`:
``$<COMPILE_LANG_AND_ID:language,compiler_ids>`` .. genex:: $<COMPILE_LANG_AND_ID:language,compiler_ids>
``1`` when the language used for compilation unit matches ``language`` and ``1`` when the language used for compilation unit matches ``language`` and
the CMake's compiler id of the language compiler matches any one of the the CMake's compiler id of the language compiler matches any one of the
entries in ``compiler_ids``, otherwise ``0``. This expression is a short form entries in ``compiler_ids``, otherwise ``0``. This expression is a short form
@@ -224,7 +280,8 @@ Variable Queries
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:Clang>>:COMPILING_C_WITH_CLANG> $<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:Clang>>:COMPILING_C_WITH_CLANG>
) )
``$<COMPILE_LANGUAGE:languages>`` .. genex:: $<COMPILE_LANGUAGE:languages>
``1`` when the language used for compilation unit matches any of the entries ``1`` when the language used for compilation unit matches any of the entries
in ``languages``, otherwise ``0``. This expression may be used to specify in ``languages``, otherwise ``0``. This expression may be used to specify
compile options, compile definitions, and include directories for source files of a compile options, compile definitions, and include directories for source files of a
@@ -269,7 +326,8 @@ Variable Queries
.. _`Boolean LINK_LANGUAGE Generator Expression`: .. _`Boolean LINK_LANGUAGE Generator Expression`:
``$<LINK_LANG_AND_ID:language,compiler_ids>`` .. genex:: $<LINK_LANG_AND_ID:language,compiler_ids>
``1`` when the language used for link step matches ``language`` and the ``1`` when the language used for link step matches ``language`` and the
CMake's compiler id of the language linker matches any one of the entries CMake's compiler id of the language linker matches any one of the entries
in ``compiler_ids``, otherwise ``0``. This expression is a short form for the in ``compiler_ids``, otherwise ``0``. This expression is a short form for the
@@ -308,7 +366,8 @@ Variable Queries
``$<LINK_LANGUAGE:language>`` for constraints about the usage of this ``$<LINK_LANGUAGE:language>`` for constraints about the usage of this
generator expression. generator expression.
``$<LINK_LANGUAGE:languages>`` .. genex:: $<LINK_LANGUAGE:languages>
``1`` when the language used for link step matches any of the entries ``1`` when the language used for link step matches any of the entries
in ``languages``, otherwise ``0``. This expression may be used to specify in ``languages``, otherwise ``0``. This expression may be used to specify
link libraries, link options, link directories and link dependencies of a link libraries, link options, link directories and link dependencies of a
@@ -370,14 +429,16 @@ Variable Queries
evaluation will give ``C`` as link language, so the second pass will evaluation will give ``C`` as link language, so the second pass will
correctly add target ``libother`` as link dependency. correctly add target ``libother`` as link dependency.
``$<DEVICE_LINK:list>`` .. genex:: $<DEVICE_LINK:list>
Returns the list if it is the device link step, an empty list otherwise. Returns the list if it is the device link step, an empty list otherwise.
The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION` The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION`
and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and
policy :policy:`CMP0105`. This expression can only be used to specify link policy :policy:`CMP0105`. This expression can only be used to specify link
options. options.
``$<HOST_LINK:list>`` .. genex:: $<HOST_LINK:list>
Returns the list if it is the normal link step, an empty list otherwise. Returns the list if it is the normal link step, an empty list otherwise.
This expression is mainly useful when a device link step is also involved This expression is mainly useful when a device link step is also involved
(see ``$<DEVICE_LINK:list>`` generator expression). This expression can only (see ``$<DEVICE_LINK:list>`` generator expression). This expression can only
@@ -433,11 +494,16 @@ Escaped Characters
String literals to escape the special meaning a character would otherwise have: String literals to escape the special meaning a character would otherwise have:
``$<ANGLE-R>`` .. genex:: $<ANGLE-R>
A literal ``>``. Used for example to compare strings that contain a ``>``. A literal ``>``. Used for example to compare strings that contain a ``>``.
``$<COMMA>``
.. genex:: $<COMMA>
A literal ``,``. Used for example to compare strings which contain a ``,``. A literal ``,``. Used for example to compare strings which contain a ``,``.
``$<SEMICOLON>``
.. genex:: $<SEMICOLON>
A literal ``;``. Used to prevent list expansion on an argument with ``;``. A literal ``;``. Used to prevent list expansion on an argument with ``;``.
.. _`Conditional Generator Expressions`: .. _`Conditional Generator Expressions`:
@@ -448,11 +514,13 @@ Conditional Expressions
Conditional generator expressions depend on a boolean condition Conditional generator expressions depend on a boolean condition
that must be ``0`` or ``1``. that must be ``0`` or ``1``.
``$<condition:true_string>`` .. genex:: $<condition:true_string>
Evaluates to ``true_string`` if ``condition`` is ``1``. Evaluates to ``true_string`` if ``condition`` is ``1``.
Otherwise evaluates to the empty string. Otherwise evaluates to the empty string.
``$<IF:condition,true_string,false_string>`` .. genex:: $<IF:condition,true_string,false_string>
Evaluates to ``true_string`` if ``condition`` is ``1``. Evaluates to ``true_string`` if ``condition`` is ``1``.
Otherwise evaluates to ``false_string``. Otherwise evaluates to ``false_string``.
@@ -471,22 +539,34 @@ otherwise expands to the empty string.
String Transformations String Transformations
---------------------- ----------------------
``$<JOIN:list,string>`` .. genex:: $<JOIN:list,string>
Joins the list with the content of ``string``. Joins the list with the content of ``string``.
``$<REMOVE_DUPLICATES:list>``
.. genex:: $<REMOVE_DUPLICATES:list>
Removes duplicated items in the given ``list``. Removes duplicated items in the given ``list``.
``$<FILTER:list,INCLUDE|EXCLUDE,regex>``
.. genex:: $<FILTER:list,INCLUDE|EXCLUDE,regex>
Includes or removes items from ``list`` that match the regular expression ``regex``. Includes or removes items from ``list`` that match the regular expression ``regex``.
``$<LOWER_CASE:string>``
.. genex:: $<LOWER_CASE:string>
Content of ``string`` converted to lower case. Content of ``string`` converted to lower case.
``$<UPPER_CASE:string>``
.. genex:: $<UPPER_CASE:string>
Content of ``string`` converted to upper case. Content of ``string`` converted to upper case.
``$<GENEX_EVAL:expr>`` .. genex:: $<GENEX_EVAL:expr>
Content of ``expr`` evaluated as a generator expression in the current Content of ``expr`` evaluated as a generator expression in the current
context. This enables consumption of generator expressions whose context. This enables consumption of generator expressions whose
evaluation results itself in generator expressions. evaluation results itself in generator expressions.
``$<TARGET_GENEX_EVAL:tgt,expr>``
.. genex:: $<TARGET_GENEX_EVAL:tgt,expr>
Content of ``expr`` evaluated as a generator expression in the context of Content of ``expr`` evaluated as a generator expression in the context of
``tgt`` target. This enables consumption of custom target properties that ``tgt`` target. This enables consumption of custom target properties that
themselves contain generator expressions. themselves contain generator expressions.
@@ -525,62 +605,99 @@ String Transformations
Variable Queries Variable Queries
---------------- ----------------
``$<CONFIG>`` .. genex:: $<CONFIG>
Configuration name. Configuration name.
``$<CONFIGURATION>``
.. genex:: $<CONFIGURATION>
Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead. Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead.
``$<PLATFORM_ID>``
.. genex:: $<PLATFORM_ID>
The current system's CMake platform id. The current system's CMake platform id.
See also the :variable:`CMAKE_SYSTEM_NAME` variable. See also the :variable:`CMAKE_SYSTEM_NAME` variable.
``$<C_COMPILER_ID>``
.. genex:: $<C_COMPILER_ID>
The CMake's compiler id of the C compiler used. The CMake's compiler id of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<CXX_COMPILER_ID>``
.. genex:: $<CXX_COMPILER_ID>
The CMake's compiler id of the CXX compiler used. The CMake's compiler id of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<CUDA_COMPILER_ID>``
.. genex:: $<CUDA_COMPILER_ID>
The CMake's compiler id of the CUDA compiler used. The CMake's compiler id of the CUDA compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<OBJC_COMPILER_ID>``
.. genex:: $<OBJC_COMPILER_ID>
The CMake's compiler id of the OBJC compiler used. The CMake's compiler id of the OBJC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<OBJCXX_COMPILER_ID>``
.. genex:: $<OBJCXX_COMPILER_ID>
The CMake's compiler id of the OBJCXX compiler used. The CMake's compiler id of the OBJCXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<Fortran_COMPILER_ID>``
.. genex:: $<Fortran_COMPILER_ID>
The CMake's compiler id of the Fortran compiler used. The CMake's compiler id of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<ISPC_COMPILER_ID>``
.. genex:: $<ISPC_COMPILER_ID>
The CMake's compiler id of the ISPC compiler used. The CMake's compiler id of the ISPC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
``$<C_COMPILER_VERSION>``
.. genex:: $<C_COMPILER_VERSION>
The version of the C compiler used. The version of the C compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<CXX_COMPILER_VERSION>``
.. genex:: $<CXX_COMPILER_VERSION>
The version of the CXX compiler used. The version of the CXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<CUDA_COMPILER_VERSION>``
.. genex:: $<CUDA_COMPILER_VERSION>
The version of the CUDA compiler used. The version of the CUDA compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<OBJC_COMPILER_VERSION>``
.. genex:: $<OBJC_COMPILER_VERSION>
The version of the OBJC compiler used. The version of the OBJC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<OBJCXX_COMPILER_VERSION>``
.. genex:: $<OBJCXX_COMPILER_VERSION>
The version of the OBJCXX compiler used. The version of the OBJCXX compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<Fortran_COMPILER_VERSION>``
.. genex:: $<Fortran_COMPILER_VERSION>
The version of the Fortran compiler used. The version of the Fortran compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<ISPC_COMPILER_VERSION>``
.. genex:: $<ISPC_COMPILER_VERSION>
The version of the ISPC compiler used. The version of the ISPC compiler used.
See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
``$<COMPILE_LANGUAGE>``
.. genex:: $<COMPILE_LANGUAGE>
The compile language of source files when evaluating compile options. The compile language of source files when evaluating compile options.
See :ref:`the related boolean expression See :ref:`the related boolean expression
<Boolean COMPILE_LANGUAGE Generator Expression>` <Boolean COMPILE_LANGUAGE Generator Expression>`
``$<COMPILE_LANGUAGE:language>`` ``$<COMPILE_LANGUAGE:language>``
for notes about the portability of this generator expression. for notes about the portability of this generator expression.
``$<LINK_LANGUAGE>``
.. genex:: $<LINK_LANGUAGE>
The link language of target when evaluating link options. The link language of target when evaluating link options.
See :ref:`the related boolean expression See :ref:`the related boolean expression
<Boolean LINK_LANGUAGE Generator Expression>` ``$<LINK_LANGUAGE:language>`` <Boolean LINK_LANGUAGE Generator Expression>` ``$<LINK_LANGUAGE:language>``
@@ -607,14 +724,19 @@ In the following, "the ``tgt`` filename" means the name of the ``tgt``
binary file. This has to be distinguished from "the target name", binary file. This has to be distinguished from "the target name",
which is just the string ``tgt``. which is just the string ``tgt``.
``$<TARGET_NAME_IF_EXISTS:tgt>`` .. genex:: $<TARGET_NAME_IF_EXISTS:tgt>
The target name ``tgt`` if the target exists, an empty string otherwise. The target name ``tgt`` if the target exists, an empty string otherwise.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_FILE:tgt>``
.. genex:: $<TARGET_FILE:tgt>
Full path to the ``tgt`` binary file. Full path to the ``tgt`` binary file.
``$<TARGET_FILE_BASE_NAME:tgt>``
.. genex:: $<TARGET_FILE_BASE_NAME:tgt>
Base name of ``tgt``, i.e. ``$<TARGET_FILE_NAME:tgt>`` without prefix and Base name of ``tgt``, i.e. ``$<TARGET_FILE_NAME:tgt>`` without prefix and
suffix. suffix.
For example, if the ``tgt`` filename is ``libbase.so``, the base name is ``base``. For example, if the ``tgt`` filename is ``libbase.so``, the base name is ``base``.
@@ -631,36 +753,48 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_FILE_PREFIX:tgt>``
.. genex:: $<TARGET_FILE_PREFIX:tgt>
Prefix of the ``tgt`` filename (such as ``lib``). Prefix of the ``tgt`` filename (such as ``lib``).
See also the :prop_tgt:`PREFIX` target property. See also the :prop_tgt:`PREFIX` target property.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_FILE_SUFFIX:tgt>``
.. genex:: $<TARGET_FILE_SUFFIX:tgt>
Suffix of the ``tgt`` filename (extension such as ``.so`` or ``.exe``). Suffix of the ``tgt`` filename (extension such as ``.so`` or ``.exe``).
See also the :prop_tgt:`SUFFIX` target property. See also the :prop_tgt:`SUFFIX` target property.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_FILE_NAME:tgt>``
.. genex:: $<TARGET_FILE_NAME:tgt>
The ``tgt`` filename. The ``tgt`` filename.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_FILE_DIR:tgt>``
.. genex:: $<TARGET_FILE_DIR:tgt>
Directory of the ``tgt`` binary file. Directory of the ``tgt`` binary file.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_LINKER_FILE:tgt>``
.. genex:: $<TARGET_LINKER_FILE:tgt>
File used when linking to the ``tgt`` target. This will usually File used when linking to the ``tgt`` target. This will usually
be the library that ``tgt`` represents (``.a``, ``.lib``, ``.so``), be the library that ``tgt`` represents (``.a``, ``.lib``, ``.so``),
but for a shared library on DLL platforms, it would be the ``.lib`` but for a shared library on DLL platforms, it would be the ``.lib``
import library associated with the DLL. import library associated with the DLL.
``$<TARGET_LINKER_FILE_BASE_NAME:tgt>``
.. genex:: $<TARGET_LINKER_FILE_BASE_NAME:tgt>
Base name of file used to link the target ``tgt``, i.e. Base name of file used to link the target ``tgt``, i.e.
``$<TARGET_LINKER_FILE_NAME:tgt>`` without prefix and suffix. For example, ``$<TARGET_LINKER_FILE_NAME:tgt>`` without prefix and suffix. For example,
if target file name is ``libbase.a``, the base name is ``base``. if target file name is ``libbase.a``, the base name is ``base``.
@@ -676,7 +810,9 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_LINKER_FILE_PREFIX:tgt>``
.. genex:: $<TARGET_LINKER_FILE_PREFIX:tgt>
Prefix of file used to link target ``tgt``. Prefix of file used to link target ``tgt``.
See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target
@@ -684,7 +820,9 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_LINKER_FILE_SUFFIX:tgt>``
.. genex:: $<TARGET_LINKER_FILE_SUFFIX:tgt>
Suffix of file used to link where ``tgt`` is the name of a target. Suffix of file used to link where ``tgt`` is the name of a target.
The suffix corresponds to the file extension (such as ".so" or ".lib"). The suffix corresponds to the file extension (such as ".so" or ".lib").
@@ -694,36 +832,49 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_LINKER_FILE_NAME:tgt>``
.. genex:: $<TARGET_LINKER_FILE_NAME:tgt>
Name of file used to link target ``tgt``. Name of file used to link target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_LINKER_FILE_DIR:tgt>``
.. genex:: $<TARGET_LINKER_FILE_DIR:tgt>
Directory of file used to link target ``tgt``. Directory of file used to link target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_SONAME_FILE:tgt>``
.. genex:: $<TARGET_SONAME_FILE:tgt>
File with soname (``.so.3``) where ``tgt`` is the name of a target. File with soname (``.so.3``) where ``tgt`` is the name of a target.
``$<TARGET_SONAME_FILE_NAME:tgt>`` .. genex:: $<TARGET_SONAME_FILE_NAME:tgt>
Name of file with soname (``.so.3``). Name of file with soname (``.so.3``).
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_SONAME_FILE_DIR:tgt>``
.. genex:: $<TARGET_SONAME_FILE_DIR:tgt>
Directory of with soname (``.so.3``). Directory of with soname (``.so.3``).
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PDB_FILE:tgt>``
.. genex:: $<TARGET_PDB_FILE:tgt>
Full path to the linker generated program database file (.pdb) Full path to the linker generated program database file (.pdb)
where ``tgt`` is the name of a target. where ``tgt`` is the name of a target.
See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
target properties and their configuration specific variants target properties and their configuration specific variants
:prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`. :prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`.
``$<TARGET_PDB_FILE_BASE_NAME:tgt>``
.. genex:: $<TARGET_PDB_FILE_BASE_NAME:tgt>
Base name of the linker generated program database file (.pdb) Base name of the linker generated program database file (.pdb)
where ``tgt`` is the name of a target. where ``tgt`` is the name of a target.
@@ -739,23 +890,31 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_PDB_FILE_NAME:tgt>``
.. genex:: $<TARGET_PDB_FILE_NAME:tgt>
Name of the linker generated program database file (.pdb). Name of the linker generated program database file (.pdb).
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PDB_FILE_DIR:tgt>``
.. genex:: $<TARGET_PDB_FILE_DIR:tgt>
Directory of the linker generated program database file (.pdb). Directory of the linker generated program database file (.pdb).
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_BUNDLE_DIR:tgt>``
.. genex:: $<TARGET_BUNDLE_DIR:tgt>
Full path to the bundle directory (``my.app``, ``my.framework``, or Full path to the bundle directory (``my.app``, ``my.framework``, or
``my.bundle``) where ``tgt`` is the name of a target. ``my.bundle``) where ``tgt`` is the name of a target.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_BUNDLE_CONTENT_DIR:tgt>``
.. genex:: $<TARGET_BUNDLE_CONTENT_DIR:tgt>
Full path to the bundle content directory where ``tgt`` is the name of a Full path to the bundle content directory where ``tgt`` is the name of a
target. For the macOS SDK it leads to ``my.app/Contents``, ``my.framework``, target. For the macOS SDK it leads to ``my.app/Contents``, ``my.framework``,
or ``my.bundle/Contents``. For all other SDKs (e.g. iOS) it leads to or ``my.bundle/Contents``. For all other SDKs (e.g. iOS) it leads to
@@ -764,17 +923,23 @@ which is just the string ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`). expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_PROPERTY:tgt,prop>``
.. genex:: $<TARGET_PROPERTY:tgt,prop>
Value of the property ``prop`` on the target ``tgt``. Value of the property ``prop`` on the target ``tgt``.
Note that ``tgt`` is not added as a dependency of the target this Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on. expression is evaluated on.
``$<TARGET_PROPERTY:prop>``
.. genex:: $<TARGET_PROPERTY:prop>
Value of the property ``prop`` on the target for which the expression Value of the property ``prop`` on the target for which the expression
is being evaluated. Note that for generator expressions in is being evaluated. Note that for generator expressions in
:ref:`Target Usage Requirements` this is the consuming target rather :ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement. than the target specifying the requirement.
``$<INSTALL_PREFIX>``
.. genex:: $<INSTALL_PREFIX>
Content of the install prefix when the target is exported via Content of the install prefix when the target is exported via
:command:`install(EXPORT)`, or when evaluated in :command:`install(EXPORT)`, or when evaluated in
:prop_tgt:`INSTALL_NAME_DIR`, and empty otherwise. :prop_tgt:`INSTALL_NAME_DIR`, and empty otherwise.
@@ -782,30 +947,43 @@ which is just the string ``tgt``.
Output-Related Expressions Output-Related Expressions
-------------------------- --------------------------
``$<TARGET_NAME:...>`` .. genex:: $<TARGET_NAME:...>
Marks ``...`` as being the name of a target. This is required if exporting Marks ``...`` as being the name of a target. This is required if exporting
targets to multiple dependent export sets. The ``...`` must be a literal targets to multiple dependent export sets. The ``...`` must be a literal
name of a target- it may not contain generator expressions. name of a target- it may not contain generator expressions.
``$<LINK_ONLY:...>``
.. genex:: $<LINK_ONLY:...>
Content of ``...`` except when evaluated in a link interface while Content of ``...`` except when evaluated in a link interface while
propagating :ref:`Target Usage Requirements`, in which case it is the propagating :ref:`Target Usage Requirements`, in which case it is the
empty string. empty string.
Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target
property, perhaps via the :command:`target_link_libraries` command, property, perhaps via the :command:`target_link_libraries` command,
to specify private link dependencies without other usage requirements. to specify private link dependencies without other usage requirements.
``$<INSTALL_INTERFACE:...>``
.. genex:: $<INSTALL_INTERFACE:...>
Content of ``...`` when the property is exported using :command:`install(EXPORT)`, Content of ``...`` when the property is exported using :command:`install(EXPORT)`,
and empty otherwise. and empty otherwise.
``$<BUILD_INTERFACE:...>``
.. genex:: $<BUILD_INTERFACE:...>
Content of ``...`` when the property is exported using :command:`export`, or Content of ``...`` when the property is exported using :command:`export`, or
when the target is used by another target in the same buildsystem. Expands to when the target is used by another target in the same buildsystem. Expands to
the empty string otherwise. the empty string otherwise.
``$<MAKE_C_IDENTIFIER:...>``
.. genex:: $<MAKE_C_IDENTIFIER:...>
Content of ``...`` converted to a C identifier. The conversion follows the Content of ``...`` converted to a C identifier. The conversion follows the
same behavior as :command:`string(MAKE_C_IDENTIFIER)`. same behavior as :command:`string(MAKE_C_IDENTIFIER)`.
``$<TARGET_OBJECTS:objLib>``
.. genex:: $<TARGET_OBJECTS:objLib>
List of objects resulting from build of ``objLib``. List of objects resulting from build of ``objLib``.
``$<SHELL_PATH:...>``
.. genex:: $<SHELL_PATH:...>
Content of ``...`` converted to shell path style. For example, slashes are Content of ``...`` converted to shell path style. For example, slashes are
converted to backslashes in Windows shells and drive letters are converted converted to backslashes in Windows shells and drive letters are converted
to posix paths in MSYS shells. The ``...`` must be an absolute path. to posix paths in MSYS shells. The ``...`` must be an absolute path.
@@ -815,7 +993,8 @@ Output-Related Expressions
``;`` on Windows). Be sure to enclose the argument containing this genex ``;`` on Windows). Be sure to enclose the argument containing this genex
in double quotes in CMake source code so that ``;`` does not split arguments. in double quotes in CMake source code so that ``;`` does not split arguments.
``$<OUTPUT_CONFIG:...>`` .. genex:: $<OUTPUT_CONFIG:...>
.. versionadded:: 3.20 .. versionadded:: 3.20
Only valid in :command:`add_custom_command` and :command:`add_custom_target` Only valid in :command:`add_custom_command` and :command:`add_custom_target`
@@ -824,7 +1003,8 @@ Output-Related Expressions
in ``...`` are evaluated using the custom command's "output config". in ``...`` are evaluated using the custom command's "output config".
With other generators, the content of ``...`` is evaluated normally. With other generators, the content of ``...`` is evaluated normally.
``$<COMMAND_CONFIG:...>`` .. genex:: $<COMMAND_CONFIG:...>
.. versionadded:: 3.20 .. versionadded:: 3.20
Only valid in :command:`add_custom_command` and :command:`add_custom_target` Only valid in :command:`add_custom_command` and :command:`add_custom_target`