ECMDeprecationSettings — Extra CMake Modules 6.29.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 `ECMGenerateExportHeader`. 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(
        [DISABLE_NEWER_WARNINGS] # since 5.96
        [<identifier> <deprecation_version>]
        [<identifier2> <deprecation_version2>]
    )

`DISABLE_NEWER_WARNINGS` disables additionally the compiler warnings for API deprecated in newer versions of the same major version.

Example usage:

    set(QT_MIN_VERSION "5.15.2")
    set(KF5_MIN_VERSION "5.90")

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

Since 5.91