Debian Codegraph @

subprojects/meson-docs/docs/markdown/Feature-autodetection.md

raw
1 ---
2 short-description: Auto-detection of features like ccache and code coverage
3 ...
4
5 # Feature autodetection
6
7 Meson is designed for high productivity. It tries to do as many things
8 automatically as it possibly can.
9
10 Ccache
11 --
12
13 [Ccache](https://ccache.dev/) is a cache system designed to make
14 compiling faster. When you run Meson for the first time for a given
15 project, it checks if Ccache is installed. If it is, Meson will use it
16 automatically.
17
18 If you do not wish to use Ccache for some reason, just specify your
19 compiler with environment variables `CC` and/or `CXX` when first
20 running Meson (remember that once specified the compiler cannot be
21 changed). Meson will then use the specified compiler without Ccache.
22
23 Coverage
24 --
25
26 When doing a code coverage build, Meson will check for existence of
27 the binaries `gcovr`, `lcov` and `genhtml`. If version 3.3 or higher
28 of the first is found, targets called *coverage-text*, *coverage-xml*
29 and *coverage-html* are generated. If version 4.2 or higher of the
30 first is found, targets *coverage-text*, *coverage-xml*, *coverage-sonarqube*
31 and *coverage-html* are generated. Alternatively, if the latter two
32 are found, only the target *coverage-html* is generated. Coverage
33 reports can then be produced simply by calling e.g. `meson compile
34 coverage-xml`. As a convenience, a high-level *coverage* target is
35 also generated which will produce all 3 coverage report types, if
36 possible.
37
38 Note that generating any of the coverage reports described above
39 requires the tests (i.e. `meson test`) to finish running so the
40 information about the functions that are called in the tests can be
41 gathered for the report.