-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default_both_libraries=static has no effect #14158
Comments
It is intended for cases where the project author is convinced that offering the choice between The default_both_libraries option does something else entirely. And apparently the docs for it are very confusing, sorry! There would be no point in having the option choose which library is built and installed, since then it would just be mylib = both_libraries('foolib', 'foolib.c', install: true)
myprog = executable('barprog', 'barprog.c', link_with: mylib, install: true) barprog would always link dynamically to foolib, although other people using foolib could freely choose to link statically or dynamically by using With this option you could do |
What could I do to improve documentation? |
@eli-schwartz thank you for the clarification. @bruchar1 I would propose something along these lines: diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index 3a912805a..86b729ed0 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -183,11 +183,16 @@ fails.
#### Details for `default_both_libraries`
-Since `1.6.0`, you can select the default type of library selected when using
-a `both_libraries` object. This can be either 'shared' (default value, compatible
-with previous meson versions), 'static', or 'auto'. With auto, the value from
-`default_library` option is used, unless it is 'both', in which case 'shared'
-is used instead.
+Since `1.6.0`, you can select the default type of library selected when using a
+`both_libraries` object. Note that, unlike `default_library`, this option does
+not affect how the library artifacts are built, but how they are internally
+linked to the applications (either executables or other libraries) within the
+same project.
+
+The possible values of this option are 'shared' (default value,
+compatible with previous meson versions), 'static', and 'auto'. With auto, the
+value from `default_library` option is used, unless it is 'both', in which case
+'shared' is used instead.
When `default_both_libraries` is 'auto', passing a [[@both_libs]] dependency
in [[both_libraries]] will link the static dependency with the static lib, Does it make sense? |
Describe the bug
Suppose there is a meson.build file with:
and a foo.c file with:
With meson 1.6.1, running
meson setup build -Ddefault_both_libraries=static
still builds and installs both shared (.so) and static (.a) libraries of libfoo.If I change
both_libraries
tolibrary
, and supply-Ddefault_library=static
, it only builds a static library.To Reproduce
See the above.
Expected behavior
When
-Ddefault_both_libraries=static
or-Ddefault_both_libraries=auto -Ddefault_library=static
is specified, only a static library is built and installed.system parameters
meson --version
: 1.6.1ninja --version
if it's a Ninja build: 1.12.1The text was updated successfully, but these errors were encountered: