# CMP0158

New in version 3.29.

`add_test()` honors `CMAKE_CROSSCOMPILING_EMULATOR` only when `cross-compiling`.

In CMake 3.28 and below, `add_test()` unconditionally used the `CROSSCOMPILING_EMULATOR` target property (initialized by the `CMAKE_CROSSCOMPILING_EMULATOR` variable) to run test commands naming executable targets. CMake 3.29 and above prefer to use the emulator only when the `CMAKE_CROSSCOMPILING` variable is enabled. The `CMAKE_TEST_LAUNCHER` variable may be used instead when not cross-compiling. This policy provides compatibility for projects that have not been updated.

The `OLD` behavior for this policy is for `add_test()` to use the `CROSSCOMPILING_EMULATOR` target property unconditionally. The `NEW` behavior for this policy is for `add_test()` to use the `CROSSCOMPILING_EMULATOR` target property only when `cross-compiling`.

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

Note

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