inja
                                
                                 inja copied to clipboard
                                
                                    inja copied to clipboard
                            
                            
                            
                        Add option to disable tests and benchmarks with Meson
This adds options to disable building the tests or benchmarks when using inja directly as a subproject in Meson. By default, both tests and benchmarks will be built.
Changing the values can be done when importing the subproject like this:
inja_proj = subproject('inja', default_options: [
    'build_benchmark=true',
    'build_tests=false'
])
Hi @bbastin, thanks for your PR! Is there any chance to get this feature without adding the auxiliary meson_options.txt file?
Hey, thanks for getting back!
I am no meson expert, but according to the documentation (https://mesonbuild.com/Build-options.html), the options are only located inside the meson_options.txt.
I have tried whether inline options are supported, but it causes the following error:
meson.build:3:0: ERROR: Tried to call option() in build description file. All options must be in the option file.
Unfortunately, it seems like this is the only way to do this. I understand that having another file at top level leads to more clutter. I would still appreciate this change, as I usually run all tests in my projects with meson test and this then also executes all of inja's tests. One other option, if you really disliked the additional file, would be to add the tests to their own suite, I could write another pull request doing that.
I would still appreciate this change, as I usually run all tests in my projects with
meson testand this then also executes all of inja's tests.
Note: it is also possible to use --suite projectname and only run the tests for your own project (avoiding all subprojects).
This is independent of whether the test executables are compiled.