diff options
author | Joachim Wuttke (h) <j.wuttke@fz-juelich.de> | 2018-11-04 22:13:21 (GMT) |
---|---|---|
committer | Joachim Wuttke (o) <j.wuttke@fz-juelich.de> | 2018-11-06 11:55:25 (GMT) |
commit | ab1d7df7575503c8eabdf6f8892b5944b06d98e5 (patch) | |
tree | edf833ace95b8072262a2e8c7af72900f830c52c /Help/manual | |
parent | e0f0f80f0286b7181b1203693799f5fcfcd8b4af (diff) | |
download | CMake-ab1d7df7575503c8eabdf6f8892b5944b06d98e5.zip CMake-ab1d7df7575503c8eabdf6f8892b5944b06d98e5.tar.gz CMake-ab1d7df7575503c8eabdf6f8892b5944b06d98e5.tar.bz2 |
Help: add section on debugging generator expressions.
This resolves #18550.
Diffstat (limited to 'Help/manual')
-rw-r--r-- | Help/manual/cmake-generator-expressions.7.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index eb9c9fe..b5c4457 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -440,3 +440,25 @@ Output-Related Expressions 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. + +Debugging +========= + +Since generator expressions are evaluated during generation of the buildsystem, +and not during processing of ``CMakeLists.txt`` files, it is not possible to +inspect their result with the :command:`message()` command. + +One possible way to generate debug messages is to add a custom target, + +.. code-block:: cmake + + add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<...>") + +The shell command ``make genexdebug`` (invoked after execution of ``cmake``) +would then print the result of ``$<...>``. + +Another way is to write debug messages to a file: + +.. code-block:: cmake + + file(GENERATE OUTPUT filename CONTENT "$<...>") |