Technical requirements
You can find the code files that are present in this chapter on GitHub at https://github.com/PacktPublishing/Modern-CMake-for-Cpp-2E/tree/main/examples/ch15.
To build the examples provided in this book, always use the recommended commands:
cmake -B <build tree> -S <source tree>
cmake --build <build tree>
Be sure to replace the placeholders <build tree>
and <source tree>
with appropriate paths. As a reminder: the build tree is the path to the target/output directory, and the source tree is the path at which your source code is located.
This chapter is compiled with GCC to provide compatibility between code coverage instrumentation with the lcov
tool used to collect the results. If you want to compile with llvm
or another toolchain, be sure to adapt the coverage processing as needed.
To run tests, execute the following command:
ctest --test-dir <build tree>
Or simply execute it from the build tree...