CMP0166 — CMake 4.2.6 Documentation

# CMP0166

Added in version 3.30.

`TARGET_PROPERTY` evaluates link properties transitively over private dependencies of static libraries.

In CMake 3.29 and below, the `TARGET_PROPERTY` generator expression evaluates properties `INTERFACE_LINK_OPTIONS`, `INTERFACE_LINK_DIRECTORIES`, and `INTERFACE_LINK_DEPENDS` as if they were Transitive Compile Properties rather than Transitive Link Properties, even when policy `CMP0099` is set to `NEW`. Private dependencies of static libraries, which appear in their `INTERFACE_LINK_LIBRARIES` guarded by `LINK_ONLY` generator expressions, are not followed. This is inconsistent with evaluation of the same target properties during buildsystem generation.

CMake 3.30 and above prefer that `TARGET_PROPERTY` evaluates properties `INTERFACE_LINK_OPTIONS`, `INTERFACE_LINK_DIRECTORIES`, and `INTERFACE_LINK_DEPENDS` as Transitive Link Properties such that private dependencies of static libraries, which appear in their `INTERFACE_LINK_LIBRARIES` guarded by `LINK_ONLY` generator expressions, are followed. This policy provides compatibility for projects that have not been updated to expect the new behavior.

The `OLD` behavior for this policy is for `TARGET_PROPERTY` to evaluate properties `INTERFACE_LINK_OPTIONS`, `INTERFACE_LINK_DIRECTORIES`, and `INTERFACE_LINK_DEPENDS` as if they were Transitive Compile Properties by not following private dependencies of static libraries. The `NEW` behavior for this policy is to evaluate them as Transitive Link Properties by following private dependencies of static libraries.

This policy was introduced in CMake version 3.30. 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.