Skip to main content
100%

CMakeLists.txt enable GTest

✓ Published0🌍 Public
IIoTeacher
Last edited Apr 8, 2020
Created on May 18, 2020

This example shows a CMake build configuration that conditionally enables Google Test (GTest) support for a C++ project named "modio". The code defines a build-time option triggered by the `test` variable set to "on", which activates testing features. When enabled, it compiles all source files from the `src` directory into a test executable called `runUnitTests` and links it against the `gtest` and `gtest_main` libraries. The configuration also registers the executable as a CTest test named `UnitTests` using `add_test`, and it sets up the necessary include paths for GTest's headers and source directory from the `ext/googletest` subdirectory.

AI-generated description

Similar vizzes