CMake: Remove superfluous depfile in QML type registration

In _qt_internal_qml_type_registration we created a depfile that
contained the *_metatypes.json files of target's SOURCES.

This depfile was used in the custom command that produces
${target}_qmltyperegistration.cpp.

It doesn't seem necessary to create a depfile, and one could use the
DEPENDS option of add_custom_command instead. And indeed, commit
ce950d619a added the same dependencies
this way. Presumably, this was done to fix dependencies for older CMake
versions and generators that do not support depfiles.

This commit removes the creation of the depfile.

This double dependency declaration was found when investigating
QTBUG-106683, and it turns out that removing the depfile fixes the
problem of re-generating ${target}_qmltyperegistration.cpp for Visual
Studio generators.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-106683
Change-Id: I6cf909dfb4a9b31b76599b7ad35ad6f595ca0891
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Joerg Bornemann 2023-06-13 08:29:52 +02:00
parent 8a74155411
commit 470fee3217
1 changed files with 0 additions and 25 deletions

View File

@ -2564,28 +2564,6 @@ function(_qt_internal_qml_type_registration target)
message(FATAL_ERROR "Need target metatypes.json file")
endif()
cmake_policy(PUSH)
_qt_internal_check_depfile_support(has_depfile_support)
set(registration_cpp_file_dep_args)
if(has_depfile_support)
if(POLICY CMP0116)
# Without explicitly setting this policy to NEW, we get a warning
# even though we ensure there's actually no problem here.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21959
cmake_policy(SET CMP0116 NEW)
set(relative_to_dir ${CMAKE_CURRENT_BINARY_DIR})
else()
set(relative_to_dir ${CMAKE_BINARY_DIR})
endif()
set(dependency_file_cpp "${target_binary_dir}/qmltypes/${type_registration_cpp_file_name}.d")
set(registration_cpp_file_dep_args DEPFILE ${dependency_file_cpp})
file(RELATIVE_PATH cpp_file_name "${relative_to_dir}" "${type_registration_cpp_file}")
file(GENERATE OUTPUT "${dependency_file_cpp}"
CONTENT "${cpp_file_name}: $<IF:$<BOOL:${genex_list}>,\\\n$<JOIN:${genex_list}, \\\n>, \\\n>"
)
endif()
_qt_internal_get_tool_wrapper_script_path(tool_wrapper)
add_custom_command(
OUTPUT
@ -2606,13 +2584,10 @@ function(_qt_internal_qml_type_registration target)
${CMAKE_COMMAND} -E make_directory "${generated_marker_dir}"
COMMAND
${CMAKE_COMMAND} -E touch "${generated_marker_file}"
${registration_cpp_file_dep_args}
COMMENT "Automatic QML type registration for target ${target}"
VERBATIM
)
cmake_policy(POP)
# The ${target}_qmllint targets need to depend on the generation of all
# *.qmltypes files in the build. We have no way of reliably working out
# which QML modules a given target depends on at configure time, so we