summaryrefslogtreecommitdiffstats
path: root/Help/manual
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-24 15:05:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-04-24 15:06:19 (GMT)
commit195400cab7256d655d313c5155880dad5545becc (patch)
treeacb1001aca0b5ab01fce53495c1775a32d14e0a8 /Help/manual
parentb928be62fa403403ba5d8bc7521b5a8ae5ff54cf (diff)
parent4d15046eddcd6326fd7229adcb3bdb93717f3e06 (diff)
downloadCMake-195400cab7256d655d313c5155880dad5545becc.zip
CMake-195400cab7256d655d313c5155880dad5545becc.tar.gz
CMake-195400cab7256d655d313c5155880dad5545becc.tar.bz2
Merge topic 'Genex-TARGET_GENEX_PROPERTY'
4d15046edd Genex: Add $<TARGET_GENEX_EVAL:...> and $<GENEX_EVAL:...> Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1984
Diffstat (limited to 'Help/manual')
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst39
1 files changed, 39 insertions, 0 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index 0e73bd2..8fd07d7 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -305,3 +305,42 @@ Available output expressions are:
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.
+``$<GENEX_EVAL:...>``
+ Content of ``...`` 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,...>``
+ Content of ``...`` evaluated as a generator expression in the context of
+ ``tgt`` target. This enables consumption of custom target properties that
+ themselves contain generator expressions.
+
+ Having the capability to evaluate generator expressions is very useful when
+ you want to manage custom properties supporting generator expressions.
+ For example:
+
+ .. code-block:: cmake
+
+ add_library(foo ...)
+
+ set_property(TARGET foo PROPERTY
+ CUSTOM_KEYS $<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>
+ )
+
+ add_custom_target(printFooKeys
+ COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_PROPERTY:foo,CUSTOM_KEYS>
+ )
+
+ This naive implementation of the ``printFooKeys`` custom command is wrong
+ because ``CUSTOM_KEYS`` target property is not evaluated and the content
+ is passed as is (i.e. ``$<$<CONFIG:DEBUG>:FOO_EXTRA_THINGS>``).
+
+ To have the expected result (i.e. ``FOO_EXTRA_THINGS`` if config is
+ ``Debug``), it is required to evaluate the output of
+ ``$<TARGET_PROPERTY:foo,CUSTOM_KEYS>``:
+
+ .. code-block:: cmake
+
+ add_custom_target(printFooKeys
+ COMMAND ${CMAKE_COMMAND} -E
+ echo $<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:foo,CUSTOM_KEYS>>
+ )