Add gcc option to meson

For example, I need to add the following compiling switches (options) to gcc when meson makes the build directory:

-fmax-error=1 -Wall

How is it possible?

OS: Ubuntu 20.04

1 Answer

You may add this as an example to the main meson.build file:

add_global_arguments('-fmax-errors=1', language : 'c')

If you need to add multiple gcc flags, you should repeat the line, one per an option (flag). Note that it should be placed after 'project' call, since it should be the first function call in the file.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like