summaryrefslogtreecommitdiff
path: root/docs/markdown/Configuring-a-build-directory.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-04-14 12:58:30 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2025-02-13 23:57:48 +0200
commitd37d649b08b832d52fa684bc0506829fb40d5261 (patch)
treec66e1461e91d6349457b826978e866fdabb19de1 /docs/markdown/Configuring-a-build-directory.md
parentea678ed82938ceac00682b2695b57193d36b71b4 (diff)
downloadmeson-d37d649b08b832d52fa684bc0506829fb40d5261.tar.gz
Make all Meson level options overridable per subproject.
Diffstat (limited to 'docs/markdown/Configuring-a-build-directory.md')
-rw-r--r--docs/markdown/Configuring-a-build-directory.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md
index 746e4b16b..974b7ae99 100644
--- a/docs/markdown/Configuring-a-build-directory.md
+++ b/docs/markdown/Configuring-a-build-directory.md
@@ -119,3 +119,40 @@ by invoking [`meson configure`](Commands.md#configure) with the
project source directory or the path to the root `meson.build`. In
this case, Meson will print the default values of all options similar
to the example output from above.
+
+## Per project subproject options rewrite (Since 1.8)
+
+A common requirement when building large projects with many
+subprojects is to build some (or all) subprojects with project options
+that are different from the "main project". This has been sort of
+possible in a limited way but is now natively supported. Per project
+options can be added, changed and removed at runtime using the command
+line, in other words, without editing existing `meson.build` files.
+
+Starting with version 1.8 you can specify per-project option settings.
+These can be specified for every top level (i.e. not project) options.
+Suppose you have a project that has a single subproject called
+`numbercruncher` that does heavy computation. During development you
+want to build that subproject with optimizations enabled but your main
+project without optimizations. This can be done by specifying a custom
+value to the given subproject:
+
+ meson configure -Dnumbercruncher:optimization=3
+
+Another case might be that you want to build with warnings as errors,
+but some subproject does not support it. To configure `werror` per
+subproject you can do:
+
+ meson configure -Dwerror=true -Dnaughty:werror=false
+
+You can also specify a different value on the top level project. For
+example you could enable optimizations on all subprojects but not the
+top level project:
+
+ meson configure -Doptimization=2 -D:optimization=0
+
+Note the colon after the second `D`.
+
+Subproject specific values can be removed with -U
+
+ meson configure -Usubproject:optionnname