[In your CmakeLists.txt add](https://google.github.io/googletest/quickstart-cmake.html):
```cmake
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
```
The above configuration declares a dependency on GoogleTest which is downloaded from GitHub. In the above example, `03597a01ee50ed33e9dfd640b249b4be3799d395` is the [Git commit hash](https://github.com/google/googletest/commits/main) of the [GoogleTest version](https://github.com/google/googletest/tags) to use; update the hash often to point to the latest version.