ECMDeprecationSettings — Extra CMake Modules 5.94.0 documentation

# ECMDeprecationSettings

This module provides the `ecm_set_disabled_deprecation_versions` function setting the excluding deprecated API for QT and KF projects.

This method expects pairs of the identifier and deprecation version. For the identifier “QT” this functions adds the definition “QT_DISABLE_DEPRECATED_BEFORE” with the given version in a hexadecimal format. Otherwise the name for the definition is generated using ${IDENTIFIER}_DISABLE_DEPRECATED_BEFORE_AND_AT, following the naming of the generated code in `ECMGenerateExportHeaders`. The version for the definition can be overwritten, by passing definition name and the deprecation version as a CMake definition. This allows one to exclude deprecations without having to edit the CMakeLists.txt file.

This module provides the following function:

    ecm_set_disabled_deprecation_versions(
        [SHOW_DEPRECATIONS]
        [<identifier> <deprecation_version>]
        [<identifier2> <deprecation_version2>]
    )

`SHOW_DEPRECATIONS` if this option is used, deprecation warnings for the current major version are emitted.

Example usage:

    set(QT_MIN_VERSION "5.15.0")
    set(KF5_MIN_VERSION "5.90")

    ecm_set_disabled_deprecation_versions(SHOW_DEPRECATIONS
      QT ${QT_MIN_VERSION}
      KF ${KF5_MIN_VERSION}
      KCOREADDONS 5.89.0 # In case we depend on deprecated KCoreAddons API
    )

Since 5.91