diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 604bb47cc0..949982eeb5 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1224,9 +1224,23 @@ function(qt6_extract_metatypes target) add_dependencies(${target}_automoc_json_extraction ${target}_autogen) _qt_internal_assign_to_internal_targets_folder(${target}_automoc_json_extraction) else() - set(cmake_autogen_timestamp_file - "${target_autogen_build_dir}/timestamp" - ) + set(use_better_automoc_graph FALSE) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.28.0" + AND CMAKE_CROSS_CONFIGS) + if(DEFINED QT_USE_BETTER_AUTOMOC_GRAPH) + set(use_better_automoc_graph ${QT_USE_BETTER_AUTOMOC_GRAPH}) + else() + set(use_better_automoc_graph TRUE) + endif() + endif() + + if(use_better_automoc_graph) + set(cmake_autogen_timestamp_file + "${target_autogen_build_dir}/timestamp_$") + else() + set(cmake_autogen_timestamp_file + "${target_autogen_build_dir}/timestamp") + endif() add_custom_command(OUTPUT ${type_list_file} DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::cmake_automoc_parser