We have scraped the surface of FetchContent and its build-time cousin, ExternalProject_Add, and we will revisit these commands in Chapter 8, The Superbuild Pattern. For a detailed discussion of the available options, please consult https://cmake.org/cmake/help/v3.11/module/FetchContent.html.
In this recipe, we fetched the sources at configure time, but we could have also installed them on the system environment and used the FindGTest module to detect the library and header files (https://cmake.org/cmake/help/v3.5/module/FindGTest.html). From version 3.9, CMake also offers a GoogleTest module (https://cmake.org/cmake/help/v3.9/module/GoogleTest.html), which provides a gtest_add_tests function. This function can be used to automatically add tests, by scanning the source code for Google Test macros.