Skip to content

Commit

Permalink
Fix the aostats targets handling
Browse files Browse the repository at this point in the history
When calling both qt_add_qml_module and qt_target_qml_sources without
QML_FILES, cofiguration fails because of duplicated target records in
the _qt_qml_aotstats_module_targets property.

In general extending the existing API with the double invocation guard
ADDING_QML_MODULE is completely pointless. We simply should move the
related logic to qt_add_qml_module.

Remove the ADDING_QML_MODULE flag to avoid littering the public API
with some internals and ensure that the target do not land to
_qt_qml_aotstats_module_targets list twice by moving the respective
logic.

Amends 09f5197

Pick-to: 6.8 6.9
Task-number: QTBUG-130087
Task-number: QTBUG-124667
Change-Id: I743b6ed89a5639e39384cfa3c621a88c3dfa409e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
  • Loading branch information
semlanik committed Jan 2, 2025
1 parent e2a3e57 commit 7d36867
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/qml/Qt6QmlMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,6 @@ Check https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html for policy details."
RESOURCES ${arg_RESOURCES}
OUTPUT_TARGETS cache_target
PREFIX "${qt_qml_module_resource_prefix}"
ADDING_QML_MODULE
)
list(APPEND output_targets ${cache_target})

Expand Down Expand Up @@ -1073,6 +1072,11 @@ Check https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html for policy details."
endif()

if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.19.0")
set_property(GLOBAL APPEND PROPERTY _qt_qml_aotstats_module_targets ${target})
set_target_properties(${target} PROPERTIES
QT_QML_MODULE_RCC_QMLCACHE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.rcc/qmlcache"
)

get_cmake_property(aotstats_setup_called _qt_internal_deferred_aotstats_setup)
if(NOT aotstats_setup_called)
set_property(GLOBAL PROPERTY _qt_internal_deferred_aotstats_setup TRUE)
Expand Down Expand Up @@ -2868,7 +2872,6 @@ function(qt6_target_qml_sources target)
NO_CACHEGEN
NO_QMLDIR_TYPES
__QT_INTERNAL_FORCE_DEFER_QMLDIR # Used only by qt6_add_qml_module()
ADDING_QML_MODULE
)

set(args_single
Expand All @@ -2888,10 +2891,6 @@ function(qt6_target_qml_sources target)
message(FATAL_ERROR "Unknown/unexpected arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()

if(NOT arg_QML_FILES)
set_property(GLOBAL APPEND PROPERTY _qt_qml_aotstats_module_targets ${target})
endif()

get_target_property(no_lint ${target} QT_QML_MODULE_NO_LINT)
if(NOT arg_QML_FILES AND NOT arg_RESOURCES)
if(NOT arg_NO_LINT AND NOT no_lint)
Expand Down Expand Up @@ -3388,12 +3387,9 @@ function(qt6_target_qml_sources target)
endif()
endforeach()

if(arg_ADDING_QML_MODULE AND "${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.19.0")
set_property(GLOBAL APPEND PROPERTY _qt_qml_aotstats_module_targets ${target})
set_target_properties(${target} PROPERTIES
QT_QML_MODULE_AOTSTATS_FILES "${aotstats_files}"
QT_QML_MODULE_RCC_QMLCACHE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.rcc/qmlcache"
)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
set_property(TARGET ${target} APPEND PROPERTY
QT_QML_MODULE_AOTSTATS_FILES ${aotstats_files})
endif()

if(ANDROID)
Expand Down

0 comments on commit 7d36867

Please sign in to comment.