Open sfan5 opened 1 year ago
I wonder what the intended behavior is supposed to be. Are you of any docs that talk about this precedence?
@tristan957 This is what the docs say the precedence should be
You can set some Meson built-in options on a per-subproject basis, such as default_library and werror. The order of precedence is:
- Command line
- Machine file
- Build system definitions
Issue persists in meson 1.1.0.
@xclaesse you said you might know this issue right?
The problem is on reconfigure we reload machine files and override options with what it contains. Meson should remember the source of every option (command line, machine file, env, etc) and only override if it got changed in a higher priority source. That means when reloading machine file we should override the option if the value we got was from env but not if it was from command line. That's also the reason why we don't update options when changing project(..., default_options: ...)
because we don,t know if current value comes from command line or not.
This is something I got told that muon does correctly.
Describe the bug Situation: Your cross file specifies libraries to build as static, but you configure a certain project to build as shared. You configure, build, get a shared library and all is fine. Then you edit your cross file in any way. The next time you build meson will automatically reconfigure, the shared setting gets "lost" and you suddenly get a static library.
To Reproduce meson.build:
hello.c:
crossfile.txt
meson build --cross-file crossfile.txt --default-library shared
meson compile -C build
->[2/2] Linking target libhello.so
touch crossfile.txt
meson compile -C build
-> a reconfigure runs and you get[2/2] Linking static target libhello.a
Expected behavior Step 4 still links a shared library.
system parameters
meson --version
: 1.0.0ninja --version
: 1.11.1