aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Subprojects.md
diff options
context:
space:
mode:
authorandy5995 <andy400-dev@yahoo.com>2022-01-16 16:09:14 -0600
committerJussi Pakkanen <jpakkane@gmail.com>2022-01-23 15:27:09 +0200
commit14d811f64734205326b4c661d0083c5221829a3f (patch)
treefa2e67976d12c3e6a6cbf186124d12fe7a1390fd /docs/markdown/Subprojects.md
parentbaff6bccac5f4f476033276bed8a9cc3cb3c5a15 (diff)
downloadmeson-14d811f64734205326b4c661d0083c5221829a3f.zip
meson-14d811f64734205326b4c661d0083c5221829a3f.tar.gz
meson-14d811f64734205326b4c661d0083c5221829a3f.tar.bz2
Subprojects.md:add extra detail
This adds a link https://mesonbuild.com/Builtin-options.html#specifying-options-per-subproject in two different places and provides an example for changing the default options. This info is partially based on a [recent discussion](https://github.com/mesonbuild/meson/discussions/9830) between me and @eli-schwartz [skip ci]
Diffstat (limited to 'docs/markdown/Subprojects.md')
-rw-r--r--docs/markdown/Subprojects.md33
1 files changed, 24 insertions, 9 deletions
diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md
index 636d70c..09ff8bf 100644
--- a/docs/markdown/Subprojects.md
+++ b/docs/markdown/Subprojects.md
@@ -84,12 +84,13 @@ return variables as strings.
### Build options in subproject
All Meson features of the subproject, such as project options keep
-working and can be set in the master project. There are a few
-limitations, the most important being that global compiler arguments
-must be set in the main project before calling subproject. Subprojects
-must not set global arguments because there is no way to do that
-reliably over multiple subprojects. To check whether you are running
-as a subproject, use [[meson.is_subproject]].
+working and [can be set in the master
+project](Builtin-options.md#specifying-options-per-subproject). There
+are a few limitations, the most important being that global compiler
+arguments must be set in the main project before calling subproject.
+Subprojects must not set global arguments because there is no way to
+do that reliably over multiple subprojects. To check whether you are
+running as a subproject, use [[meson.is_subproject]].
## Using a subproject
@@ -175,9 +176,23 @@ executable('my_project',
install : true)
```
-With this setup when libsimple is provided by the system, we use it.
-When that is not the case we use the embedded version (the one from
-subprojects).
+You may change default [options of the
+subproject](Builtin-options.md#specifying-options-per-subproject) by
+adding a keyword argument to the invocation. For example, to change the
+default library type:
+
+```
+libsimple_dep = dependency(
+ 'libsimple',
+ fallback : ['libsimple', 'libsimple_dep'],
+ default_options: ['default_library=static']
+)
+```
+
+With this setup, when libsimple is provided by the system we use it and
+completely ignore subproject options (i.e. we link to a shared system
+library). When that is not the case, we use the embedded version (the
+one from subprojects).
Note that `libsimple_dep` can point to an external or an internal
dependency but you don't have to worry about their differences. Meson