cmake_minimum_required(VERSION 3.10)
project(MyTestProject)

# Enable testing: Without calling `enable_testing()`, you cannot use the `add_test()` command, and testing features will not be available in your project.
enable_testing()

# Find Google Test
find_package(GTest REQUIRED)

# Include directories for Google Test
include_directories(${GTEST_INCLUDE_DIRS})

# Add your test source file
add_executable(my_tests my_tests.cpp)

# Link Google Test libraries
target_link_libraries(my_tests GTest::GTest GTest::Main)

# Add the test to CTest: registers a test with the CMake testing system; You can define and run multiple tests in an organized way; Works seamlessly with continuous integration systems to automate testing pipelines; You can pass specific arguments to your test binary.
add_test(NAME MyTests COMMAND my_tests)