meson icon indicating copy to clipboard operation
meson copied to clipboard

Using -Dbuildtype and -Doptimization + -Ddebug is not redundant despite the warning.

Open averms opened this issue 4 years ago • 2 comments

Describe the bug

When using both -Dbuildtype and -Doptimization, Meson gives the following warning:

WARNING: Recommend using either -Dbuildtype or -Doptimization + -Ddebug. Using both is redundant since they override each other. See: https://mesonbuild.com/Builtin-options.html#build-type-options

However, one can have good reason for passing both. The build type is a variable that is used in meson.build files and in Meson itself. For example, it is used when deciding whether to define NDEBUG if b_ndebug=if-release. That is why I pass -Dbuildtype=debug to my debug builds even when I want to choose a different optimization level. It seems to me that the simplest solution is that the warning should be removed.

To Reproduce

meson setup -Dbuildtype=debug -Doptimization=g build

If the meson.build has the default build type set to release and the developer wants to build for debugging with -Og, they will naturally want to change both buildtype and optimization.

Expected behavior No warning

system parameters Meson 0.60.0

averms avatar Nov 07 '21 03:11 averms

Hmm, appears it is also used for b_vscrt, and for somehow classifying boost dependency libraries.

And also for some languages like java, d, and mono which should probably get moved from _buildtype_args to _debug_args && _optimization_args.

eli-schwartz avatar Nov 07 '21 04:11 eli-schwartz

Looks like someone else ran up against this (see rule 4): https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/

averms avatar Nov 21 '22 22:11 averms