summaryrefslogtreecommitdiffstats
path: root/Help
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
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')
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst39
-rw-r--r--Help/release/dev/genex-GENEX_EVAL.rst7
2 files changed, 46 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>>
+ )
diff --git a/Help/release/dev/genex-GENEX_EVAL.rst b/Help/release/dev/genex-GENEX_EVAL.rst
new file mode 100644
index 0000000..0869c93
--- /dev/null
+++ b/Help/release/dev/genex-GENEX_EVAL.rst
@@ -0,0 +1,7 @@
+genex-GENEX_EVAL
+----------------
+
+* New ``$<GENEX_EVAL:...>`` and ``$<TARGET_GENEX_EVAL:target,...>``
+ :manual:`generator expression <cmake-generator-expressions(7)>`
+ had been added to enable consumption of generator expressions whose
+ evaluation results itself in generator expressions.