.\" Man page generated from reStructuredText. . .TH "CMAKE-GENERATOR-EXPRESSIONS" "7" "August 09, 2019" "3.15.2" "CMake" .SH NAME cmake-generator-expressions \- CMake Generator Expressions . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH INTRODUCTION .sp Generator expressions are evaluated during build system generation to produce information specific to each build configuration. .sp Generator expressions are allowed in the context of many target properties, such as \fBLINK_LIBRARIES\fP, \fBINCLUDE_DIRECTORIES\fP, \fBCOMPILE_DEFINITIONS\fP and others. They may also be used when using commands to populate those properties, such as \fBtarget_link_libraries()\fP, \fBtarget_include_directories()\fP, \fBtarget_compile_definitions()\fP and others. .sp They enable conditional linking, conditional definitions used when compiling, conditional include directories, and more. The conditions may be based on the build configuration, target properties, platform information or any other queryable information. .sp Generator expressions have the form \fB$<...>\fP\&. To avoid confusion, this page deviates from most of the CMake documentation in that it omits angular brackets \fB<...>\fP around placeholders like \fBcondition\fP, \fBstring\fP, \fBtarget\fP, among others. .sp Generator expressions can be nested, as shown in most of the examples below. .SH BOOLEAN GENERATOR EXPRESSIONS .sp Boolean expressions evaluate to either \fB0\fP or \fB1\fP\&. They are typically used to construct the condition in a \fI\%conditional generator expression\fP\&. .sp Available boolean expressions are: .SS Logical Operators .INDENT 0.0 .TP .B \fB$\fP Converts \fBstring\fP to \fB0\fP or \fB1\fP according to the rules of the \fBif()\fP command. Evaluates to \fB0\fP if any of the following is true: .INDENT 7.0 .IP \(bu 2 \fBstring\fP is empty, .IP \(bu 2 \fBstring\fP is a case\-insensitive equal of \fB0\fP, \fBFALSE\fP, \fBOFF\fP, \fBN\fP, \fBNO\fP, \fBIGNORE\fP, or \fBNOTFOUND\fP, or .IP \(bu 2 \fBstring\fP ends in the suffix \fB\-NOTFOUND\fP (case\-sensitive). .UNINDENT .sp Otherwise evaluates to \fB1\fP\&. .TP .B \fB$\fP where \fBconditions\fP is a comma\-separated list of boolean expressions. Evaluates to \fB1\fP if all conditions are \fB1\fP\&. Otherwise evaluates to \fB0\fP\&. .TP .B \fB$\fP where \fBconditions\fP is a comma\-separated list of boolean expressions. Evaluates to \fB1\fP if at least one of the conditions is \fB1\fP\&. Otherwise evaluates to \fB0\fP\&. .TP .B \fB$\fP \fB0\fP if \fBcondition\fP is \fB1\fP, else \fB1\fP\&. .UNINDENT .SS String Comparisons .INDENT 0.0 .TP .B \fB$\fP \fB1\fP if \fBstring1\fP and \fBstring2\fP are equal, else \fB0\fP\&. The comparison is case\-sensitive. For a case\-insensitive comparison, combine with a \fI\%string transforming generator expression\fP, .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C $,"BAR"> # "1" if ${foo} is any of "BAR", "Bar", "bar", ... .ft P .fi .UNINDENT .UNINDENT .TP .B \fB$\fP \fB1\fP if \fBvalue1\fP and \fBvalue2\fP are numerically equal, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if \fBstring\fP is member of the semicolon\-separated \fBlist\fP, else \fB0\fP\&. Uses case\-sensitive comparisons. .TP .B \fB$\fP \fB1\fP if \fBv1\fP is a version less than \fBv2\fP, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if \fBv1\fP is a version greater than \fBv2\fP, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if \fBv1\fP is the same version as \fBv2\fP, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if \fBv1\fP is a version less than or equal to \fBv2\fP, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if \fBv1\fP is a version greater than or equal to \fBv2\fP, else \fB0\fP\&. .UNINDENT .SS Variable Queries .INDENT 0.0 .TP .B \fB$\fP \fB1\fP if \fBtarget\fP exists, else \fB0\fP\&. .TP .B \fB$\fP \fB1\fP if config is \fBcfg\fP, else \fB0\fP\&. This is a case\-insensitive comparison. The mapping in \fBMAP_IMPORTED_CONFIG_\fP is also considered by this expression when it is evaluated on a property on an \fBIMPORTED\fP target. .TP .B \fB$\fP where \fBplatform_ids\fP is a comma\-separated list. \fB1\fP if the CMake\(aqs platform id matches any one of the entries in \fBplatform_ids\fP, otherwise \fB0\fP\&. See also the \fBCMAKE_SYSTEM_NAME\fP variable. .TP .B \fB$\fP where \fBcompiler_ids\fP is a comma\-separated list. \fB1\fP if the CMake\(aqs compiler id of the C compiler matches any one of the entries in \fBcompiler_ids\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP where \fBcompiler_ids\fP is a comma\-separated list. \fB1\fP if the CMake\(aqs compiler id of the CXX compiler matches any one of the entries in \fBcompiler_ids\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP where \fBcompiler_ids\fP is a comma\-separated list. \fB1\fP if the CMake\(aqs compiler id of the CUDA compiler matches any one of the entries in \fBcompiler_ids\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP where \fBcompiler_ids\fP is a comma\-separated list. \fB1\fP if the CMake\(aqs compiler id of the Fortran compiler matches any one of the entries in \fBcompiler_ids\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP \fB1\fP if the version of the C compiler matches \fBversion\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP \fB1\fP if the version of the CXX compiler matches \fBversion\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP \fB1\fP if the version of the CXX compiler matches \fBversion\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP \fB1\fP if the version of the Fortran compiler matches \fBversion\fP, otherwise \fB0\fP\&. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP \fB1\fP if the \fBpolicy\fP was NEW when the \(aqhead\(aq target was created, else \fB0\fP\&. If the \fBpolicy\fP was not set, the warning message for the policy will be emitted. This generator expression only works for a subset of policies. .TP .B \fB$\fP where \fBfeatures\fP is a comma\-spearated list. Evaluates to \fB1\fP if all of the \fBfeatures\fP are available for the \(aqhead\(aq target, and \fB0\fP otherwise. If this expression is used while evaluating the link implementation of a target and if any dependency transitively increases the required \fBC_STANDARD\fP or \fBCXX_STANDARD\fP for the \(aqhead\(aq target, an error is reported. See the \fBcmake\-compile\-features(7)\fP manual for information on compile features and a list of supported compilers. .UNINDENT .INDENT 0.0 .TP .B \fB$\fP \fB1\fP when the language used for compilation unit matches \fBlanguage\fP and the CMake\(aqs compiler id of the language compiler matches any one of the entries in \fBcompiler_ids\fP, otherwise \fB0\fP\&. This expression is a short form for the combination of \fB$\fP and \fB$\fP\&. This expression may be used to specify compile options, compile definitions, and include directories for source files of a particular language and compiler combination in a target. For example: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add_executable(myapp main.cpp foo.c bar.cpp zot.cu) target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX_WITH_CLANG> $<$:COMPILING_CXX_WITH_INTEL> $<$:COMPILING_C_WITH_CLANG> ) .ft P .fi .UNINDENT .UNINDENT .sp This specifies the use of different compile definitions based on both the compiler id and compilation language. This example will have a \fBCOMPILING_CXX_WITH_CLANG\fP compile definition when Clang is the CXX compiler, and \fBCOMPILING_CXX_WITH_INTEL\fP when Intel is the CXX compiler. Likewise when the C compiler is Clang it will only see the \fBCOMPILING_C_WITH_CLANG\fP definition. .sp Without the \fBCOMPILE_LANG_AND_ID\fP generator expression the same logic would be expressed as: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C target_compile_definitions(myapp PRIVATE $<$,$>:COMPILING_CXX_WITH_CLANG> $<$,$>:COMPILING_CXX_WITH_INTEL> $<$,$>:COMPILING_C_WITH_CLANG> ) .ft P .fi .UNINDENT .UNINDENT .TP .B \fB$\fP \fB1\fP when the language used for compilation unit matches any of the entries in \fBlanguages\fP, otherwise \fB0\fP\&. This expression may be used to specify compile options, compile definitions, and include directories for source files of a particular language in a target. For example: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add_executable(myapp main.cpp foo.c bar.cpp zot.cu) target_compile_options(myapp PRIVATE $<$:\-fno\-exceptions> ) target_compile_definitions(myapp PRIVATE $<$:COMPILING_CXX> $<$:COMPILING_CUDA> ) target_include_directories(myapp PRIVATE $<$:/opt/foo/headers> ) .ft P .fi .UNINDENT .UNINDENT .sp This specifies the use of the \fB\-fno\-exceptions\fP compile option, \fBCOMPILING_CXX\fP compile definition, and \fBcxx_headers\fP include directory for C++ only (compiler id checks elided). It also specifies a \fBCOMPILING_CUDA\fP compile definition for CUDA. .sp Note that with \fIVisual Studio Generators\fP and \fBXcode\fP there is no way to represent target\-wide compile definitions or include directories separately for \fBC\fP and \fBCXX\fP languages. Also, with \fIVisual Studio Generators\fP there is no way to represent target\-wide flags separately for \fBC\fP and \fBCXX\fP languages. Under these generators, expressions for both C and C++ sources will be evaluated using \fBCXX\fP if there are any C++ sources and otherwise using \fBC\fP\&. A workaround is to create separate libraries for each source file language instead: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add_library(myapp_c foo.c) add_library(myapp_cxx bar.cpp) target_compile_options(myapp_cxx PUBLIC \-fno\-exceptions) add_executable(myapp main.cpp) target_link_libraries(myapp myapp_c myapp_cxx) .ft P .fi .UNINDENT .UNINDENT .UNINDENT .SH STRING-VALUED GENERATOR EXPRESSIONS .sp These expressions expand to some string. For example, .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C include_directories(/usr/include/$/) .ft P .fi .UNINDENT .UNINDENT .sp expands to \fB/usr/include/GNU/\fP or \fB/usr/include/Clang/\fP etc, depending on the compiler identifier. .sp String\-valued expressions may also be combined with other expressions. Here an example for a string\-valued expression within a boolean expressions within a conditional expression: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $<$,4.2.0>:OLD_COMPILER> .ft P .fi .UNINDENT .UNINDENT .sp expands to \fBOLD_COMPILER\fP if the \fBCMAKE_CXX_COMPILER_VERSION\fP is less than 4.2.0. .sp And here two nested string\-valued expressions: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C \-I$, \-I> .ft P .fi .UNINDENT .UNINDENT .sp generates a string of the entries in the \fBINCLUDE_DIRECTORIES\fP target property with each entry preceded by \fB\-I\fP\&. .sp Expanding on the previous example, if one first wants to check if the \fBINCLUDE_DIRECTORIES\fP property is non\-empty, then it is advisable to introduce a helper variable to keep the code readable: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set(prop "$") # helper variable $<$:\-I$> .ft P .fi .UNINDENT .UNINDENT .sp The following string\-valued generator expressions are available: .SS Escaped Characters .sp String literals to escape the special meaning a character would otherwise have: .INDENT 0.0 .TP .B \fB$\fP A literal \fB>\fP\&. Used for example to compare strings that contain a \fB>\fP\&. .TP .B \fB$\fP A literal \fB,\fP\&. Used for example to compare strings which contain a \fB,\fP\&. .TP .B \fB$\fP A literal \fB;\fP\&. Used to prevent list expansion on an argument with \fB;\fP\&. .UNINDENT .SS Conditional Expressions .sp Conditional generator expressions depend on a boolean condition that must be \fB0\fP or \fB1\fP\&. .INDENT 0.0 .TP .B \fB$\fP Evaluates to \fBtrue_string\fP if \fBcondition\fP is \fB1\fP\&. Otherwise evaluates to the empty string. .TP .B \fB$\fP Evaluates to \fBtrue_string\fP if \fBcondition\fP is \fB1\fP\&. Otherwise evaluates to \fBfalse_string\fP\&. .UNINDENT .sp Typically, the \fBcondition\fP is a \fI\%boolean generator expression\fP\&. For instance, .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $<$:DEBUG_MODE> .ft P .fi .UNINDENT .UNINDENT .sp expands to \fBDEBUG_MODE\fP when the \fBDebug\fP configuration is used, and otherwise expands to the empty string. .SS String Transformations .INDENT 0.0 .TP .B \fB$\fP Joins the list with the content of \fBstring\fP\&. .TP .B \fB$\fP Removes duplicated items in the given \fBlist\fP\&. .TP .B \fB$\fP Includes or removes items from \fBlist\fP that match the regular expression \fBregex\fP\&. .TP .B \fB$\fP Content of \fBstring\fP converted to lower case. .TP .B \fB$\fP Content of \fBstring\fP converted to upper case. .TP .B \fB$\fP Content of \fBexpr\fP evaluated as a generator expression in the current context. This enables consumption of generator expressions whose evaluation results itself in generator expressions. .TP .B \fB$\fP Content of \fBexpr\fP evaluated as a generator expression in the context of \fBtgt\fP target. This enables consumption of custom target properties that themselves contain generator expressions. .sp Having the capability to evaluate generator expressions is very useful when you want to manage custom properties supporting generator expressions. For example: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add_library(foo ...) set_property(TARGET foo PROPERTY CUSTOM_KEYS $<$:FOO_EXTRA_THINGS> ) add_custom_target(printFooKeys COMMAND ${CMAKE_COMMAND} \-E echo $ ) .ft P .fi .UNINDENT .UNINDENT .sp This naive implementation of the \fBprintFooKeys\fP custom command is wrong because \fBCUSTOM_KEYS\fP target property is not evaluated and the content is passed as is (i.e. \fB$<$:FOO_EXTRA_THINGS>\fP). .sp To have the expected result (i.e. \fBFOO_EXTRA_THINGS\fP if config is \fBDebug\fP), it is required to evaluate the output of \fB$\fP: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add_custom_target(printFooKeys COMMAND ${CMAKE_COMMAND} \-E echo $> ) .ft P .fi .UNINDENT .UNINDENT .UNINDENT .SS Variable Queries .INDENT 0.0 .TP .B \fB$\fP Configuration name. .TP .B \fB$\fP Configuration name. Deprecated since CMake 3.0. Use \fBCONFIG\fP instead. .TP .B \fB$\fP The current system\(aqs CMake platform id. See also the \fBCMAKE_SYSTEM_NAME\fP variable. .TP .B \fB$\fP The CMake\(aqs compiler id of the C compiler used. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP The CMake\(aqs compiler id of the CXX compiler used. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP The CMake\(aqs compiler id of the CUDA compiler used. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP The CMake\(aqs compiler id of the Fortran compiler used. See also the \fBCMAKE__COMPILER_ID\fP variable. .TP .B \fB$\fP The version of the C compiler used. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP The version of the CXX compiler used. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP The version of the CUDA compiler used. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP The version of the Fortran compiler used. See also the \fBCMAKE__COMPILER_VERSION\fP variable. .TP .B \fB$\fP The compile language of source files when evaluating compile options. See \fI\%the related boolean expression\fP \fB$\fP for notes about the portability of this generator expression. .UNINDENT .SS Target\-Dependent Queries .INDENT 0.0 .TP .B \fB$\fP Expands to the \fBtgt\fP if the given target exists, an empty string otherwise. .TP .B \fB$\fP Full path to main file (.exe, .so.1.2, .a) where \fBtgt\fP is the name of a target. .TP .B \fB$\fP Base name of main file where \fBtgt\fP is the name of a target. .sp The base name corresponds to the target file name (see \fB$\fP) without prefix and suffix. For example, if target file name is \fBlibbase.so\fP, the base name is \fBbase\fP\&. .sp See also the \fBOUTPUT_NAME\fP, \fBARCHIVE_OUTPUT_NAME\fP, \fBLIBRARY_OUTPUT_NAME\fP and \fBRUNTIME_OUTPUT_NAME\fP target properties and their configuration specific variants \fBOUTPUT_NAME_\fP, \fBARCHIVE_OUTPUT_NAME_\fP, \fBLIBRARY_OUTPUT_NAME_\fP and \fBRUNTIME_OUTPUT_NAME_\fP\&. .sp The \fB_POSTFIX\fP and \fBDEBUG_POSTFIX\fP target properties can also be considered. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Prefix of main file where \fBtgt\fP is the name of a target. .sp See also the \fBPREFIX\fP target property. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Suffix of main file where \fBtgt\fP is the name of a target. .sp The suffix corresponds to the file extension (such as ".so" or ".exe"). .sp See also the \fBSUFFIX\fP target property. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Name of main file (.exe, .so.1.2, .a). .TP .B \fB$\fP Directory of main file (.exe, .so.1.2, .a). .TP .B \fB$\fP File used to link (.a, .lib, .so) where \fBtgt\fP is the name of a target. .TP .B \fB$\fP Base name of file used to link where \fBtgt\fP is the name of a target. .sp The base name corresponds to the target linker file name (see \fB$\fP) without prefix and suffix. For example, if target file name is \fBlibbase.a\fP, the base name is \fBbase\fP\&. .sp See also the \fBOUTPUT_NAME\fP, \fBARCHIVE_OUTPUT_NAME\fP, and \fBLIBRARY_OUTPUT_NAME\fP target properties and their configuration specific variants \fBOUTPUT_NAME_\fP, \fBARCHIVE_OUTPUT_NAME_\fP and \fBLIBRARY_OUTPUT_NAME_\fP\&. .sp The \fB_POSTFIX\fP and \fBDEBUG_POSTFIX\fP target properties can also be considered. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Prefix of file used to link where \fBtgt\fP is the name of a target. .sp See also the \fBPREFIX\fP and \fBIMPORT_PREFIX\fP target properties. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Suffix of file used to link where \fBtgt\fP is the name of a target. .sp The suffix corresponds to the file extension (such as ".so" or ".lib"). .sp See also the \fBSUFFIX\fP and \fBIMPORT_SUFFIX\fP target properties. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Name of file used to link (.a, .lib, .so). .TP .B \fB$\fP Directory of file used to link (.a, .lib, .so). .TP .B \fB$\fP File with soname (.so.3) where \fBtgt\fP is the name of a target. .TP .B \fB$\fP Name of file with soname (.so.3). .TP .B \fB$\fP Directory of with soname (.so.3). .TP .B \fB$\fP Full path to the linker generated program database file (.pdb) where \fBtgt\fP is the name of a target. .sp See also the \fBPDB_NAME\fP and \fBPDB_OUTPUT_DIRECTORY\fP target properties and their configuration specific variants \fBPDB_NAME_\fP and \fBPDB_OUTPUT_DIRECTORY_\fP\&. .TP .B \fB$\fP Base name of the linker generated program database file (.pdb) where \fBtgt\fP is the name of a target. .sp The base name corresponds to the target PDB file name (see \fB$\fP) without prefix and suffix. For example, if target file name is \fBbase.pdb\fP, the base name is \fBbase\fP\&. .sp See also the \fBPDB_NAME\fP target property and its configuration specific variant \fBPDB_NAME_\fP\&. .sp The \fB_POSTFIX\fP and \fBDEBUG_POSTFIX\fP target properties can also be considered. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Name of the linker generated program database file (.pdb). .TP .B \fB$\fP Directory of the linker generated program database file (.pdb). .TP .B \fB$\fP Full path to the bundle directory (\fBmy.app\fP, \fBmy.framework\fP, or \fBmy.bundle\fP) where \fBtgt\fP is the name of a target. .TP .B \fB$\fP Full path to the bundle content directory where \fBtgt\fP is the name of a target. For the macOS SDK it leads to \fBmy.app/Contents\fP, \fBmy.framework\fP, or \fBmy.bundle/Contents\fP\&. For all other SDKs (e.g. iOS) it leads to \fBmy.app\fP, \fBmy.framework\fP, or \fBmy.bundle\fP due to the flat bundle structure. .TP .B \fB$\fP Value of the property \fBprop\fP on the target \fBtgt\fP\&. .sp Note that \fBtgt\fP is not added as a dependency of the target this expression is evaluated on. .TP .B \fB$\fP Value of the property \fBprop\fP on the target on which the generator expression is evaluated. Note that for generator expressions in \fITarget Usage Requirements\fP this is the value of the property on the consuming target rather than the target specifying the requirement. .TP .B \fB$\fP Content of the install prefix when the target is exported via \fBinstall(EXPORT)\fP and empty otherwise. .UNINDENT .SS Output\-Related Expressions .INDENT 0.0 .TP .B \fB$\fP Marks \fB\&...\fP as being the name of a target. This is required if exporting targets to multiple dependent export sets. The \fB\&...\fP must be a literal name of a target\- it may not contain generator expressions. .TP .B \fB$\fP Content of \fB\&...\fP except when evaluated in a link interface while propagating \fITarget Usage Requirements\fP, in which case it is the empty string. Intended for use only in an \fBINTERFACE_LINK_LIBRARIES\fP target property, perhaps via the \fBtarget_link_libraries()\fP command, to specify private link dependencies without other usage requirements. .TP .B \fB$\fP Content of \fB\&...\fP when the property is exported using \fBinstall(EXPORT)\fP, and empty otherwise. .TP .B \fB$\fP Content of \fB\&...\fP when the property is exported using \fBexport()\fP, or when the target is used by another target in the same buildsystem. Expands to the empty string otherwise. .TP .B \fB$\fP Content of \fB\&...\fP converted to a C identifier. The conversion follows the same behavior as \fBstring(MAKE_C_IDENTIFIER)\fP\&. .TP .B \fB$\fP List of objects resulting from build of \fBobjLib\fP\&. .TP .B \fB$\fP Content of \fB\&...\fP 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 \fB\&...\fP must be an absolute path. The \fB\&...\fP may be a \fIsemicolon\-separated list\fP of paths, in which case each path is converted individually and a result list is generated using the shell path separator (\fB:\fP on POSIX and \fB;\fP on Windows). Be sure to enclose the argument containing this genex in double quotes in CMake source code so that \fB;\fP does not split arguments. .UNINDENT .SH DEBUGGING .sp Since generator expressions are evaluated during generation of the buildsystem, and not during processing of \fBCMakeLists.txt\fP files, it is not possible to inspect their result with the \fBmessage()\fP command. .sp One possible way to generate debug messages is to add a custom target, .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} \-E echo "$<...>") .ft P .fi .UNINDENT .UNINDENT .sp The shell command \fBmake genexdebug\fP (invoked after execution of \fBcmake\fP) would then print the result of \fB$<...>\fP\&. .sp Another way is to write debug messages to a file: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C file(GENERATE OUTPUT filename CONTENT "$<...>") .ft P .fi .UNINDENT .UNINDENT .SH COPYRIGHT 2000-2019 Kitware, Inc. and Contributors .\" Generated by docutils manpage writer. .