CMP0101 — CMake 4.0.1 Documentation

# CMP0101

Added in version 3.17.

`target_compile_options()` now always honors the `BEFORE` keyword.

In CMake 3.16 and below, the `target_compile_options()` command ignores the `BEFORE` keyword when inserting items into the `COMPILE_OPTIONS` target property (`PRIVATE` and `PUBLIC` items). CMake 3.17 and later honors the `BEFORE` keyword in all cases. This policy provides compatibility for projects that have not been updated to expect the new behavior.

The behavior of inserting items into the `INTERFACE_COMPILE_OPTIONS` target property (`PUBLIC` and `INTERFACE` items) is not affected by this policy. The `BEFORE` keyword has always been honored when adding items to `INTERFACE_COMPILE_OPTIONS`.

The `OLD` behavior for this policy is to not honor the `BEFORE` keyword when inserting into the `COMPILE_OPTIONS` property. The `NEW` behavior for this policy is to honor the `BEFORE` keyword in all cases.

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