From 92487ea33db9d882929d755308853d2ed82abd0d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Sat, 6 Jan 2018 15:33:07 -0800 Subject: Add partial_dependency method to dependencies This adds a new method, partial_dependency to all dependencies. These sub dependencies are copies of the original dependency, but with one or more of the attributes replaced with an empty list. This allows creating a sub dependency that has only cflags or drops link_arguments, for example. --- docs/markdown/snippets/partial-dependencies.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/markdown/snippets/partial-dependencies.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/partial-dependencies.md b/docs/markdown/snippets/partial-dependencies.md new file mode 100644 index 0000000..8d2136a --- /dev/null +++ b/docs/markdown/snippets/partial-dependencies.md @@ -0,0 +1,25 @@ +## Added new partial_dependency method to dependencies and libraries + +It is now possible to use only part of a dependency in a target. This allows, +for example, to only use headers with convenience libraries to avoid linking +to the same library multiple times. + +```meson + +dep = dependency('xcb') + +helper = static_library( + 'helper', + ['helper1.c', 'helper2.c'], + dependencies : dep.partial_dependency(includes : true), +] + +final = shared_library( + 'final', + ['final.c'], + dependencyes : dep, +) +``` + +A partial dependency will have the same name version as the full dependency it +is derived from, as well as any values requested. -- cgit v1.1