summaryrefslogtreecommitdiff
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-25 14:58:32 +0000
committerKitware Robot <kwrobot@kitware.com>2021-02-25 09:58:40 -0500
commita5678e46f8fd6a1f4081165b770a6249b3225e88 (patch)
tree1040273518c717f86a4f7088140baeeb6d3ac481 /Help
parentc06a6ba61a9aaa5a802078e9d9217ddf1936f116 (diff)
parentf31e8d33ef5ca31ae7881157e660fc74dcde3ffa (diff)
downloadcmake-a5678e46f8fd6a1f4081165b770a6249b3225e88.tar.gz
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')
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst23
-rw-r--r--Help/release/dev/runtime-dll-deps.rst4
2 files changed, 27 insertions, 0 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ca4ea3e0aa..e7828168de 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
diff --git a/Help/release/dev/runtime-dll-deps.rst b/Help/release/dev/runtime-dll-deps.rst
new file mode 100644
index 0000000000..831410f3bc
--- /dev/null
+++ b/Help/release/dev/runtime-dll-deps.rst
@@ -0,0 +1,4 @@
+runtime-dll-deps
+----------------
+
+* A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.