summaryrefslogtreecommitdiffstats
path: root/cmake/QtTransitiveExtras.cmake.in
blob: 2febebead9106b4190df0019751ad3a551e1a477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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()