A sample quickstart C++ project that builds a library, and a testing executable binary.
Notice
- Use
set_variable()
to exposes a variable to be consumed by another sub-directory viaget_variable()
. - Use
declare_dependency()
to avoid repetitive on how to compile the library sharing fromlib/
totest/
. - Use
test()
to define the test name
Command notices
meson setup <dir>
- to setup the build directory. It is the same asmeson <dir>
(without any sub-command, it defaults to setup).meson compile
- while at build directory, to build the project. This is equivalent toninja
.meson compile --clean
- while at build directory, to clean the artifacts. This is equivalent toninja clean
.meson compile -C <build-dir>
- if not at build directory, we can specify the build directory as well. Same asninja -C <build-dir>
.meson test
- execute test name as defined from within meson script
Wasin Thonkaew, MIT