diff options
| author | Alexey Edelev <alexey.edelev@qt.io> | 2021-11-24 16:22:18 +0100 |
|---|---|---|
| committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-12-02 16:34:23 +0100 |
| commit | 63b8840380e70c1258f56c67a2ec5edb5bdea53d (patch) | |
| tree | 465fedceda0553c0beec5e5e0f46cd03d1d97abf /src/corelib/Qt6CoreMacros.cmake | |
| parent | 7a6dd6084cb6dc3d8ad0476d9630ad7c575bca19 (diff) | |
Fix dependency chain that collects the metatype json files
cmake_automoc_parser has the logic preventing the run of moc with the
--collect-json parameter if metatype json files are not changed.
This logic only verify if the file list is changed but not their
content. This change adds a timestamp file that contains the last
metatype json file timestamp that was modified during the last
cmake_automoc_parser run. The logic still prevents of running
'moc --collect-json' when the list of metatype json files is not
changed, but also checks if their content is no changed.
Another approach it to generate the depfile that can be utilized by
CMake in add_custom_command as DEPFILE argument. But this concept only
works from the second build attempt because of an issue related to
dyndep.
Pick-to: 6.2
Fixes: QTBUG-98532
Change-Id: I713f8bfa9ae769cefe0beac0b7fa19750b00a765
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6CoreMacros.cmake')
| -rw-r--r-- | src/corelib/Qt6CoreMacros.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index c4d0b351207..a82cf30b363 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -1169,6 +1169,8 @@ function(qt6_extract_metatypes target) endif() endif() + set(cmake_automoc_parser_timestamp "${type_list_file}.timestamp") + if (NOT use_dep_files) # When a project is configured with a Visual Studio generator, CMake's # cmQtAutoGenInitializer::InitAutogenTarget() can take one of two code paths on how to @@ -1198,12 +1200,15 @@ function(qt6_extract_metatypes target) add_custom_target(${target}_automoc_json_extraction DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::cmake_automoc_parser - BYPRODUCTS ${type_list_file} + BYPRODUCTS + ${type_list_file} + "${cmake_automoc_parser_timestamp}" COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::cmake_automoc_parser --cmake-autogen-cache-file "${cmake_autogen_cache_file}" --cmake-autogen-info-file "${cmake_autogen_info_file}" --output-file-path "${type_list_file}" + --timestamp-file-path "${cmake_automoc_parser_timestamp}" ${multi_config_args} COMMENT "Running AUTOMOC file extraction for target ${target}" COMMAND_EXPAND_LISTS @@ -1217,11 +1222,13 @@ function(qt6_extract_metatypes target) add_custom_command(OUTPUT ${type_list_file} DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::cmake_automoc_parser ${cmake_autogen_timestamp_file} + BYPRODUCTS "${cmake_automoc_parser_timestamp}" COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::cmake_automoc_parser --cmake-autogen-cache-file "${cmake_autogen_cache_file}" --cmake-autogen-info-file "${cmake_autogen_info_file}" --output-file-path "${type_list_file}" + --timestamp-file-path "${cmake_automoc_parser_timestamp}" ${multi_config_args} COMMENT "Running AUTOMOC file extraction for target ${target}" COMMAND_EXPAND_LISTS |
