CMake - is there a way to check if testing is enabled?

cmake, testing

Solution

I guess you're thinking of the `BUILD_TESTING` option which is enabled by doing:

include(CTest)

and is `ON` by default.

Problem

I believe I found a piece of code that did just that, but with the documentation of CMake being so poor, I can't seem to find it anymore. In short: is there something like: ``` if(testing_enabled) ``` I can use in CMakeLists?

Original source