BUILD_TESTING — CMake 4.4.20260621-gcc70e9e-dirty Documentation

# BUILD_TESTING

Control whether the `CTest` module invokes `enable_testing()`.

The `CTest` module, when loaded by `include(CTest)`, runs code of the form:

    option(BUILD_TESTING "..." ON)
    if (BUILD_TESTING)
       # ...
       enable_testing()
       # ...
    endif()

This creates a `BUILD_TESTING` option that controls whether the `enable_testing()` command is invoked to enable generation of tests to run using `ctest(1)`. See the `add_test()` command to create tests.

Note

Call `include(CTest)` in the top-level source directory since `ctest(1)` expects to find a test file in the top-level build directory.