CMP0214 — CMake 4.4.3 Documentation

# CMP0214

Added in version 4.4.

Honor `CMAKE_EXE_LINKER_FLAGS` for Swift executable targets.

CMake 3.29 introduced `CMP0157`, which provides an abstraction for selecting the Swift compilation mode. In CMake 3.30, `CMAKE_SHARED_LINKER_FLAGS` was accidentally honored for Swift shared library targets when `CMP0157` is `NEW`, but the change went unnoticed and was not documented. The corresponding change was not made for Swift executable targets, leaving linker flag handling inconsistent between Swift executables and Swift shared libraries in CMake 3.30 through 4.3.

CMake 4.4 and above prefer to honor `CMAKE_EXE_LINKER_FLAGS` for Swift executable targets when `CMP0157` is set to `NEW`, restoring consistency with Swift shared library targets. This policy provides compatibility for projects that have not been updated to expect `CMAKE_EXE_LINKER_FLAGS` to be honored for Swift executables.

The `OLD` behavior for this policy is to not honor `CMAKE_EXE_LINKER_FLAGS` for Swift executable targets. The `NEW` behavior for this policy is to honor `CMAKE_EXE_LINKER_FLAGS` for Swift executable targets when `CMP0157` is set to `NEW`.

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