Getting ready

In this recipe, we will build and test the same source files, main.cpp, sum_integers.cpp, sum_integers.hpp, and test.cpp, as in Chapter 4, Creating and Running Tests, Recipe 3, Defining a unit test and linking against Google Test. We will download all required Google Test sources at configure time using FetchContent or ExternalProject_Add and in this recipe only focus on the fetching of dependencies at configure time, not so much on the actual source code and its unit tests.

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.