qtbase/cmake/QtTransitiveExtras.cmake.in
Alexey Edelev c6f15f57cd Introduce Qt<Module>TransitiveExtras.cmake for Qt modules
This file sets the transitive module properties provided by
Qt Module that is built using CMake versions < 3.30. The idea
is to not limit user projects capabilities and allow using
transitive Qt Module properties if user CMake version allows it.

If Qt Modules are built using CMake versions >= 3.30 this code is noop,
since values are stored directly in the respective
INTERFACE_properties.

Change-Id: I5a0bc0aa4f79a04c81dfa0fee1d37cfee5935b0f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-31 00:44:07 +02:00

39 lines
1.9 KiB
CMake

# 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()