diff options
Diffstat (limited to 'Help/manual/cmake-generator-expressions.7.rst')
-rw-r--r-- | Help/manual/cmake-generator-expressions.7.rst | 399 |
1 files changed, 298 insertions, 101 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 482b14e..ca4ea3e 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -46,7 +46,8 @@ Available boolean expressions are: Logical Operators ----------------- -``$<BOOL:string>`` +.. genex:: $<BOOL:string> + Converts ``string`` to ``0`` or ``1``. Evaluates to ``0`` if any of the following is true: @@ -57,23 +58,27 @@ Logical Operators Otherwise evaluates to ``1``. -``$<AND:conditions>`` +.. genex:: $<AND:conditions> + where ``conditions`` is a comma-separated list of boolean expressions. Evaluates to ``1`` if all conditions are ``1``. Otherwise evaluates to ``0``. -``$<OR:conditions>`` +.. genex:: $<OR:conditions> + where ``conditions`` is a comma-separated list of boolean expressions. Evaluates to ``1`` if at least one of the conditions is ``1``. Otherwise evaluates to ``0``. -``$<NOT:condition>`` +.. genex:: $<NOT:condition> + ``0`` if ``condition`` is ``1``, else ``1``. String Comparisons ------------------ -``$<STREQUAL:string1,string2>`` +.. genex:: $<STREQUAL:string1,string2> + ``1`` if ``string1`` and ``string2`` are equal, else ``0``. The comparison is case-sensitive. For a case-insensitive comparison, combine with a :ref:`string transforming generator expression @@ -83,101 +88,150 @@ String Comparisons $<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``. -``$<IN_LIST:string,list>`` + +.. genex:: $<IN_LIST:string,list> + ``1`` if ``string`` is member of the semicolon-separated ``list``, else ``0``. Uses case-sensitive comparisons. -``$<VERSION_LESS:v1,v2>`` + +.. genex:: $<VERSION_LESS:v1,v2> + ``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``. -``$<VERSION_EQUAL:v1,v2>`` + +.. genex:: $<VERSION_EQUAL:v1,v2> + ``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``. -``$<VERSION_GREATER_EQUAL:v1,v2>`` - ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``. +.. genex:: $<VERSION_GREATER_EQUAL:v1,v2> + + ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``. Variable Queries ---------------- -``$<TARGET_EXISTS:target>`` +.. genex:: $<TARGET_EXISTS:target> + ``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 case-insensitive comparison. The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` target. -``$<PLATFORM_ID:platform_ids>`` + +.. genex:: $<PLATFORM_ID:platform_ids> + where ``platform_ids`` is a comma-separated list. ``1`` if the CMake's platform id matches any one of the entries in ``platform_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the C compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the CXX compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the CUDA compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the Objective-C compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the Objective-C++ compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the Fortran compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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. ``1`` if the CMake's compiler id of the ISPC compiler matches any one of the entries in ``compiler_ids``, otherwise ``0``. 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``. 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``. 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``. 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``. 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``. 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``. 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``. 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, 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 policies. -``$<COMPILE_FEATURES:features>`` + +.. genex:: $<COMPILE_FEATURES:features> + where ``features`` is a comma-spearated list. Evaluates to ``1`` if all of the ``features`` are available for the 'head' target, and ``0`` otherwise. If this expression is used while evaluating @@ -189,7 +243,8 @@ Variable Queries .. _`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 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 @@ -225,7 +280,8 @@ Variable Queries $<$<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 in ``languages``, otherwise ``0``. This expression may be used to specify compile options, compile definitions, and include directories for source files of a @@ -270,7 +326,8 @@ Variable Queries .. _`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 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 @@ -309,7 +366,8 @@ Variable Queries ``$<LINK_LANGUAGE:language>`` for constraints about the usage of this generator expression. -``$<LINK_LANGUAGE:languages>`` +.. genex:: $<LINK_LANGUAGE:languages> + ``1`` when the language used for link step matches any of the entries in ``languages``, otherwise ``0``. This expression may be used to specify link libraries, link options, link directories and link dependencies of a @@ -371,14 +429,16 @@ Variable Queries evaluation will give ``C`` as link language, so the second pass will 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. The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION` and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties and policy :policy:`CMP0105`. This expression can only be used to specify link options. -``$<HOST_LINK:list>`` +.. genex:: $<HOST_LINK:list> + 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 (see ``$<DEVICE_LINK:list>`` generator expression). This expression can only @@ -434,11 +494,16 @@ Escaped Characters 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 ``>``. -``$<COMMA>`` + +.. genex:: $<COMMA> + 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 ``;``. .. _`Conditional Generator Expressions`: @@ -449,11 +514,13 @@ Conditional Expressions Conditional generator expressions depend on a boolean condition that must be ``0`` or ``1``. -``$<condition:true_string>`` +.. genex:: $<condition:true_string> + Evaluates to ``true_string`` if ``condition`` is ``1``. 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``. Otherwise evaluates to ``false_string``. @@ -472,22 +539,34 @@ otherwise expands to the empty string. String Transformations ---------------------- -``$<JOIN:list,string>`` +.. genex:: $<JOIN:list,string> + Joins the list with the content of ``string``. -``$<REMOVE_DUPLICATES:list>`` + +.. genex:: $<REMOVE_DUPLICATES: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``. -``$<LOWER_CASE:string>`` + +.. genex:: $<LOWER_CASE:string> + Content of ``string`` converted to lower case. -``$<UPPER_CASE:string>`` + +.. genex:: $<UPPER_CASE:string> + 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 context. This enables consumption of generator expressions whose 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 ``tgt`` target. This enables consumption of custom target properties that themselves contain generator expressions. @@ -526,62 +605,99 @@ String Transformations Variable Queries ---------------- -``$<CONFIG>`` +.. genex:: $<CONFIG> + Configuration name. -``$<CONFIGURATION>`` + +.. genex:: $<CONFIGURATION> + Configuration name. Deprecated since CMake 3.0. Use ``CONFIG`` instead. -``$<PLATFORM_ID>`` + +.. genex:: $<PLATFORM_ID> + The current system's CMake platform id. 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. 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. 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. 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. 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. 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. 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. See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable. -``$<C_COMPILER_VERSION>`` + +.. genex:: $<C_COMPILER_VERSION> + The version of the C compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<CXX_COMPILER_VERSION>`` + +.. genex:: $<CXX_COMPILER_VERSION> + The version of the CXX compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<CUDA_COMPILER_VERSION>`` + +.. genex:: $<CUDA_COMPILER_VERSION> + The version of the CUDA compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<OBJC_COMPILER_VERSION>`` + +.. genex:: $<OBJC_COMPILER_VERSION> + The version of the OBJC compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<OBJCXX_COMPILER_VERSION>`` + +.. genex:: $<OBJCXX_COMPILER_VERSION> + The version of the OBJCXX compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<Fortran_COMPILER_VERSION>`` + +.. genex:: $<Fortran_COMPILER_VERSION> + The version of the Fortran compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<ISPC_COMPILER_VERSION>`` + +.. genex:: $<ISPC_COMPILER_VERSION> + The version of the ISPC compiler used. See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable. -``$<COMPILE_LANGUAGE>`` + +.. genex:: $<COMPILE_LANGUAGE> + The compile language of source files when evaluating compile options. See :ref:`the related boolean expression <Boolean COMPILE_LANGUAGE Generator Expression>` ``$<COMPILE_LANGUAGE:language>`` for notes about the portability of this generator expression. -``$<LINK_LANGUAGE>`` + +.. genex:: $<LINK_LANGUAGE> + The link language of target when evaluating link options. See :ref:`the related boolean expression <Boolean LINK_LANGUAGE Generator Expression>` ``$<LINK_LANGUAGE:language>`` @@ -608,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", 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. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_FILE:tgt>`` + +.. genex:: $<TARGET_FILE:tgt> + 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 suffix. For example, if the ``tgt`` filename is ``libbase.so``, the base name is ``base``. @@ -632,36 +753,48 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_FILE_PREFIX:tgt>`` + +.. genex:: $<TARGET_FILE_PREFIX:tgt> + Prefix of the ``tgt`` filename (such as ``lib``). See also the :prop_tgt:`PREFIX` target property. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_FILE_SUFFIX:tgt>`` + +.. genex:: $<TARGET_FILE_SUFFIX:tgt> + Suffix of the ``tgt`` filename (extension such as ``.so`` or ``.exe``). See also the :prop_tgt:`SUFFIX` target property. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_FILE_NAME:tgt>`` + +.. genex:: $<TARGET_FILE_NAME:tgt> + The ``tgt`` filename. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on (see policy :policy:`CMP0112`). -``$<TARGET_FILE_DIR:tgt>`` + +.. genex:: $<TARGET_FILE_DIR:tgt> + Directory of the ``tgt`` binary file. Note that ``tgt`` is not added as a dependency of the target this 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 be the library that ``tgt`` represents (``.a``, ``.lib``, ``.so``), but for a shared library on DLL platforms, it would be the ``.lib`` 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. ``$<TARGET_LINKER_FILE_NAME:tgt>`` without prefix and suffix. For example, if target file name is ``libbase.a``, the base name is ``base``. @@ -677,7 +810,9 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_LINKER_FILE_PREFIX:tgt>`` + +.. genex:: $<TARGET_LINKER_FILE_PREFIX:tgt> + Prefix of file used to link target ``tgt``. See also the :prop_tgt:`PREFIX` and :prop_tgt:`IMPORT_PREFIX` target @@ -685,7 +820,9 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this 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. The suffix corresponds to the file extension (such as ".so" or ".lib"). @@ -695,36 +832,49 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_LINKER_FILE_NAME:tgt>`` + +.. genex:: $<TARGET_LINKER_FILE_NAME:tgt> + Name of file used to link target ``tgt``. Note that ``tgt`` is not added as a dependency of the target this 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``. Note that ``tgt`` is not added as a dependency of the target this 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. -``$<TARGET_SONAME_FILE_NAME:tgt>`` +.. genex:: $<TARGET_SONAME_FILE_NAME:tgt> + Name of file with soname (``.so.3``). Note that ``tgt`` is not added as a dependency of the target this 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``). Note that ``tgt`` is not added as a dependency of the target this 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) where ``tgt`` is the name of a target. See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` target properties and their configuration specific variants :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) where ``tgt`` is the name of a target. @@ -740,23 +890,31 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_PDB_FILE_NAME:tgt>`` + +.. genex:: $<TARGET_PDB_FILE_NAME:tgt> + Name of the linker generated program database file (.pdb). Note that ``tgt`` is not added as a dependency of the target this 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). Note that ``tgt`` is not added as a dependency of the target this 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 ``my.bundle``) where ``tgt`` is the name of a target. Note that ``tgt`` is not added as a dependency of the target this 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 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 @@ -765,17 +923,23 @@ which is just the string ``tgt``. Note that ``tgt`` is not added as a dependency of the target this 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``. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_PROPERTY:prop>`` + +.. genex:: $<TARGET_PROPERTY:prop> + Value of the property ``prop`` on the target for which the expression is being evaluated. Note that for generator expressions in :ref:`Target Usage Requirements` this is the consuming target rather than the target specifying the requirement. -``$<INSTALL_PREFIX>`` + +.. genex:: $<INSTALL_PREFIX> + Content of the install prefix when the target is exported via :command:`install(EXPORT)`, or when evaluated in :prop_tgt:`INSTALL_NAME_DIR`, and empty otherwise. @@ -783,30 +947,43 @@ which is just the string ``tgt``. Output-Related Expressions -------------------------- -``$<TARGET_NAME:...>`` +.. genex:: $<TARGET_NAME:...> + Marks ``...`` as being the name of a target. This is required if exporting targets to multiple dependent export sets. The ``...`` must be a literal 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 propagating :ref:`Target Usage Requirements`, in which case it is the empty string. Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property, perhaps via the :command:`target_link_libraries` command, 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)`, and empty otherwise. -``$<BUILD_INTERFACE:...>`` + +.. genex:: $<BUILD_INTERFACE:...> + 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 the empty string otherwise. -``$<MAKE_C_IDENTIFIER:...>`` + +.. genex:: $<MAKE_C_IDENTIFIER:...> + Content of ``...`` converted to a C identifier. The conversion follows the same behavior as :command:`string(MAKE_C_IDENTIFIER)`. -``$<TARGET_OBJECTS:objLib>`` + +.. genex:: $<TARGET_OBJECTS: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 converted to backslashes in Windows shells and drive letters are converted to posix paths in MSYS shells. The ``...`` must be an absolute path. @@ -816,6 +993,26 @@ Output-Related Expressions ``;`` on Windows). Be sure to enclose the argument containing this genex in double quotes in CMake source code so that ``;`` does not split arguments. +.. genex:: $<OUTPUT_CONFIG:...> + + .. versionadded:: 3.20 + + Only valid in :command:`add_custom_command` and :command:`add_custom_target` + as the outer-most generator expression in an argument. + With the :generator:`Ninja Multi-Config` generator, generator expressions + in ``...`` are evaluated using the custom command's "output config". + With other generators, the content of ``...`` is evaluated normally. + +.. genex:: $<COMMAND_CONFIG:...> + + .. versionadded:: 3.20 + + Only valid in :command:`add_custom_command` and :command:`add_custom_target` + as the outer-most generator expression in an argument. + With the :generator:`Ninja Multi-Config` generator, generator expressions + in ``...`` are evaluated using the custom command's "command config". + With other generators, the content of ``...`` is evaluated normally. + Debugging ========= |