In this recipe, we will demonstrate how to implement unit testing using the Google Test framework, with the help of CMake. In contrast to the previous recipe, the Google Test framework is more than a header file; it is a library containing a couple of files that need to be built and linked against. We could place these alongside our code project, but to make the code project more lightweight, we will choose to download a well-defined version of the Google Test sources at configure time, and then build the framework and link against it. We will use the relatively new FetchContent module (available since CMake version 3.11). We will revisit FetchContent in Chapter 8, The Superbuild Pattern, where we will discuss how the module works under the hood, and where we will also illustrate how to emulate it by using ExternalProject_Add. This recipe is inspired by (and adapted from) the example at https://cmake.org/cmake/help/v3.11/module/FetchContent.html.