mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-08 00:30:48 +00:00
Help: add section on debugging generator expressions.
This resolves #18550.
This commit is contained in:
committed by
Joachim Wuttke (o)
parent
e0f0f80f02
commit
ab1d7df757
@@ -440,3 +440,25 @@ Output-Related Expressions
|
|||||||
Content of ``...`` converted to shell path style. For example, slashes are
|
Content of ``...`` converted to shell path style. For example, slashes are
|
||||||
converted to backslashes in Windows shells and drive letters are converted
|
converted to backslashes in Windows shells and drive letters are converted
|
||||||
to posix paths in MSYS shells. The ``...`` must be an absolute path.
|
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 "$<...>")
|
||||||
|
|||||||
Reference in New Issue
Block a user