CMake: Update timestamp file for Cross-Config builds

Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8564 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `Cross-Config` builds.

The actual error message before this commit when CMake 3.28 is used:
```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```

Pick-to: 6.2 6.5 6.5.3 6.6 6.6.0
Change-Id: Ib544b18b67d2d4722f3801b1f46a0e0e18e59d48
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Orkun Tokdemir 2023-09-13 18:02:48 +02:00 committed by Alexandru Croitor
parent 6a7b7272cd
commit 8041bfba47

View File

@ -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_$<CONFIG>")
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