# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

# This file sets the transitive properties supported by Qt Libraries.
if(NOT QT_NO_CREATE_TARGETS AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)
    foreach(_qt_@target@_transitive_property_type COMPILE LINK)
        string(TOLOWER "${_qt_@target@_transitive_property_type}"
            _qt_@target@_transitive_property_type_lower)

        get_target_property(_qt_@target@_transitive_properties @QT_CMAKE_EXPORT_NAMESPACE@::@target@
            _qt_transitive_${_qt_@target@_transitive_property_type_lower}_properties)
        if(NOT _qt_@target@_transitive_properties)
            continue()
        endif()

        foreach(_qt_@target@_transitive_property IN LISTS _qt_@target@_transitive_properties)
            string(TOLOWER "_qt_internal_${_qt_@target@_transitive_property}"
                _qt_@target@_transitive_property_internal)
            get_target_property(_qt_@target@_transitive_property_value
                @QT_CMAKE_EXPORT_NAMESPACE@::@target@ ${_qt_@target@_transitive_property_internal})

            if(_qt_@target@_transitive_property_value)
                _qt_internal_add_transitive_property(@QT_CMAKE_EXPORT_NAMESPACE@::@target@
                    ${_qt_@target@_transitive_property_type} ${_qt_@target@_transitive_property})

                set_property(TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target@ PROPERTY
                    INTERFACE_${_qt_@target@_transitive_property}
                    "${_qt_@target@_transitive_property_value}")
            endif()
        endforeach()
    endforeach()
    unset(_qt_@target@_transitive_property_value)
    unset(_qt_@target@_transitive_property_internal)
    unset(_qt_@target@_transitive_property)
    unset(_qt_@target@_transitive_properties)
    unset(_qt_@target@_transitive_property_type_lower)
    unset(_qt_@target@_transitive_property_type)
endif()
