From c181f2c70bd606f0100f74844fcf9697be16c217 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 27 Apr 2022 23:45:02 -0400 Subject: Add small note that get_variable can publicize its data files Nothing elaborate, just laying down the ground rules for expected usage and pointing out that it now works. The idea is not to give people ideas, but to let projects which already have this use case, use it with confidence. --- docs/markdown/Dependencies.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/markdown/Dependencies.md') diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md index 15da929..a3e5a00 100644 --- a/docs/markdown/Dependencies.md +++ b/docs/markdown/Dependencies.md @@ -90,6 +90,28 @@ following will happen: If 'default_value' was provided that value will be returned, if 'default_value' was not provided then an error will be raised. +## Dependencies that provide resource files + +Sometimes a dependency provides installable files which other projects then +need to use. For example, wayland-protocols XML files. + +```meson +foo_dep = dependency('foo') +foo_datadir = foo_dep.get_variable('pkgdatadir') +custom_target( + 'foo-generated.c', + input: foo_datadir / 'prototype.xml', + output: 'foo-generated.c', + command: [generator, '@INPUT@', '@OUTPUT@'] +) +``` + +*Since 0.63.0* these actually work as expected, even when they come from a +(well-formed) internal dependency. This only works when treating the files to +be obtained as interchangeable with a system dependency -- e.g. only public +files may be used, and leaving the directory pointed to by the dependency is +not allowed. + # Declaring your own You can declare your own dependency objects that can be used -- cgit v1.1