CMP0224ΒΆ

Added in version 4.5.

Test fixtures use AROUND_EACH_REPEAT mode by default with ctest --repeat.

When ctest(1) repeats tests with its --repeat option, CMake 4.4 and below repeated fixture setup and cleanup tests along with the tests that require them. Each test, including the fixture tests, ran all of its repetitions before the next test started:

setup (xN) -> test (xN) -> cleanup (xN)

CMake 4.5 and above prefer to repeat the fixture as a whole, so that each repetition of a test is surrounded by its own fixture setup and cleanup:

(setup -> test -> cleanup) xN

This policy provides compatibility with projects that rely on the old behavior. It determines the default behavior when the FIXTURE_REPEAT_MODE test property is not set. The OLD behavior for this policy is EACH_TEST_SEPARATELY. The NEW behavior for this policy is AROUND_EACH_REPEAT.

The property describes a fixture rather than one test, so setting it on any one of a fixture's setup or cleanup tests is enough to make this policy irrelevant to that fixture.

Tests are not always created during the configure step by add_test(). The discover_tests() and gtest_discover_tests() commands defer test discovery to the build or test step, but they apply the policy setting as recorded when they were called. If a project adds tests through its own script listed in TEST_INCLUDE_FILES, it should set FIXTURE_REPEAT_MODE on its fixture tests explicitly.

This policy was introduced in CMake version 4.5. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn by default, and uses OLD behavior.

See documentation of the CMAKE_POLICY_WARNING_CMP0224 variable to control the warning.

Note

The OLD behavior of a policy is deprecated by definition and may be removed in a future version of CMake.