CMP0065 — CMake 4.3.0 Documentation

# CMP0065

Warning

The `OLD` behavior of this policy was removed in CMake version 4.0. This policy must be set to `NEW` by a call to `cmake_minimum_required()` or `cmake_policy()`.

Added in version 3.4.

Do not add flags to export symbols from executables without the `ENABLE_EXPORTS` target property.

CMake 3.3 and below, for historical reasons, always linked executables on some platforms with flags like `-rdynamic` to export symbols from the executables for use by any plugins they may load via `dlopen`. CMake 3.4 and above prefer to do this only for executables that are explicitly marked with the `ENABLE_EXPORTS` target property.

The `OLD` behavior of this policy is to always use the additional link flags when linking executables regardless of the value of the `ENABLE_EXPORTS` target property.

The `NEW` behavior of this policy is to only use the additional link flags when linking executables if the `ENABLE_EXPORTS` target property is set to `True`.

This policy was introduced in CMake version 3.4. Prior to removal in CMake version 4.0, it could be set by `cmake_policy()` or `cmake_minimum_required()`. If it was not set, CMake did not warn by default, and used `OLD` behavior.

See documentation of the `CMAKE_POLICY_WARNING_CMP0065` variable to control the warning in CMake versions before 4.0.