summaryrefslogtreecommitdiffstats
path: root/Help/manual
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-25 14:58:32 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-25 14:58:40 (GMT)
commita5678e46f8fd6a1f4081165b770a6249b3225e88 (patch)
tree1040273518c717f86a4f7088140baeeb6d3ac481 /Help/manual
parentc06a6ba61a9aaa5a802078e9d9217ddf1936f116 (diff)
parentf31e8d33ef5ca31ae7881157e660fc74dcde3ffa (diff)
downloadCMake-a5678e46f8fd6a1f4081165b770a6249b3225e88.zip
CMake-a5678e46f8fd6a1f4081165b770a6249b3225e88.tar.gz
CMake-a5678e46f8fd6a1f4081165b770a6249b3225e88.tar.bz2
Merge topic 'runtime-dll-deps'
f31e8d33ef Genex: Fix grammatical error in TARGET_OBJECTS error message d34d28e688 Genex: Add TARGET_RUNTIME_DLLS genex Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5837
Diffstat (limited to 'Help/manual')
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ca4ea3e..e782816 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -938,6 +938,29 @@ which is just the string ``tgt``.
:ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement.
+.. genex:: $<TARGET_RUNTIME_DLLS:tgt>
+
+ List of DLLs that the target depends on at runtime. This is determined by
+ the locations of all the ``SHARED`` and ``MODULE`` targets in the target's
+ transitive dependencies. Using this generator expression on targets other
+ than executables, ``SHARED`` libraries, and ``MODULE`` libraries is an error.
+ On non-DLL platforms, it evaluates to an empty string.
+
+ This generator expression can be used to copy all of the DLLs that a target
+ depends on into its output directory in a ``POST_BUILD`` custom command. For
+ example:
+
+ .. code-block:: cmake
+
+ find_package(foo REQUIRED)
+
+ add_executable(exe main.c)
+ target_link_libraries(exe PRIVATE foo::foo foo::bar)
+ add_custom_command(TARGET exe POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:exe> $<TARGET_FILE_DIR:exe>
+ COMMAND_EXPAND_LISTS
+ )
+
.. genex:: $<INSTALL_PREFIX>
Content of the install prefix when the target is exported via