Use _qt_internal_set_source_file_generated
Migrate implementations that set `GENERATED` source property Task-number: QTBUG-125077 Change-Id: Ia77ecf8422bf3983f7746c26e5a9994d1f6415f2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 6865c21e41be5d86b5a04889bfe28fac55c89f29) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
78dd1c5cd0
commit
d61c784273
@ -170,7 +170,7 @@ function(qt_internal_generate_fake_framework_header target)
|
||||
file(GENERATE OUTPUT "${fake_header}" CONTENT "// ignore this file\n"
|
||||
CONDITION "$<CONFIG:${main_config}>")
|
||||
target_sources(${target} PRIVATE "${fake_header}")
|
||||
set_source_files_properties("${fake_header}" PROPERTIES GENERATED ON)
|
||||
_qt_internal_set_source_file_generated(SOURCES "${fake_header}")
|
||||
set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${fake_header}")
|
||||
endfunction()
|
||||
|
||||
|
@ -251,10 +251,9 @@ function(qt_internal_add_module target)
|
||||
set(module_config_private_header "qt${arg_CONFIG_MODULE_NAME}-config_p.h")
|
||||
# qt<module>-config.h/-config_p.h header files are not marked as GENERATED automatically
|
||||
# for old CMake versions. Set the property explicitly here.
|
||||
set_source_files_properties("${module_config_header}" "${module_config_private_header}"
|
||||
PROPERTIES
|
||||
GENERATED TRUE
|
||||
SKIP_AUTOGEN TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES "${module_config_header}" "${module_config_private_header}"
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
|
||||
# Module define needs to take into account the config module name.
|
||||
@ -445,7 +444,7 @@ function(qt_internal_add_module target)
|
||||
|
||||
set(module_depends_header
|
||||
"${module_build_interface_include_dir}/${module_include_name}Depends")
|
||||
set_source_files_properties("${module_depends_header}" PROPERTIES GENERATED TRUE)
|
||||
_qt_internal_set_source_file_generated(SOURCES "${module_depends_header}")
|
||||
set_target_properties(${target} PROPERTIES _qt_module_depends_header
|
||||
"${module_depends_header}")
|
||||
if(NOT arg_HEADER_MODULE)
|
||||
@ -1496,6 +1495,11 @@ function(qt_internal_generate_cpp_global_exports target module_define_infix)
|
||||
|
||||
set(${out_public_header} "${generated_header_path}" PARENT_SCOPE)
|
||||
target_sources(${target} PRIVATE "${generated_header_path}")
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES "${generated_header_path}"
|
||||
CONFIGURE_GENERATED
|
||||
)
|
||||
# `GENERATED` property is set in order to be processed by `qt_internal_collect_module_headers`
|
||||
set_source_files_properties("${generated_header_path}" PROPERTIES GENERATED TRUE)
|
||||
endfunction()
|
||||
|
||||
|
@ -248,10 +248,7 @@ function(__qt_internal_add_static_plugin_init_object_library
|
||||
CONTENT "${import_content}"
|
||||
)
|
||||
|
||||
# CMake versions earlier than 3.18.0 can't find the generated file for some reason,
|
||||
# failing at generation phase.
|
||||
# Explicitly marking the file as GENERATED fixes the issue.
|
||||
set_source_files_properties("${generated_qt_plugin_file_name}" PROPERTIES GENERATED TRUE)
|
||||
_qt_internal_set_source_file_generated(SOURCES "${generated_qt_plugin_file_name}")
|
||||
|
||||
__qt_internal_get_static_plugin_init_target_name("${plugin_target}" plugin_init_target)
|
||||
|
||||
|
@ -142,12 +142,7 @@ function(_qt_internal_create_moc_command infile outfile moc_flags moc_options
|
||||
${_moc_working_dir}
|
||||
VERBATIM)
|
||||
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOMOC ON)
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON
|
||||
SKIP_AUTOUIC ON
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_LINTING ON)
|
||||
endif()
|
||||
_qt_internal_set_source_file_generated(SOURCES ${outfile} ${extra_output_files} SKIP_AUTOGEN)
|
||||
endfunction()
|
||||
|
||||
function(qt6_generate_moc infile outfile )
|
||||
@ -439,9 +434,9 @@ function(qt6_add_resources outfiles )
|
||||
MAIN_DEPENDENCY ${infile}
|
||||
DEPENDS ${_rc_depends} "${_out_depends}" ${QT_CMAKE_EXPORT_NAMESPACE}::rcc
|
||||
VERBATIM)
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON
|
||||
SKIP_AUTOUIC ON
|
||||
SKIP_UNITY_BUILD_INCLUSION ON
|
||||
|
||||
_qt_internal_set_source_file_generated(SOURCES "${outfile}" SKIP_AUTOGEN)
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
|
||||
SKIP_PRECOMPILE_HEADERS ON
|
||||
)
|
||||
list(APPEND ${outfiles} ${outfile})
|
||||
@ -526,15 +521,13 @@ function(qt6_add_big_resources outfiles )
|
||||
|
||||
_qt6_parse_qrc_file(${infile} _out_depends _rc_depends)
|
||||
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOGEN ON)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")
|
||||
set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_LINTING ON)
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${tmpoutfile}
|
||||
COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::rcc ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile}
|
||||
DEPENDS ${infile} ${_rc_depends} "${out_depends}" ${QT_CMAKE_EXPORT_NAMESPACE}::rcc
|
||||
COMMENT "Running rcc pass 1 for resource ${outfilename}"
|
||||
VERBATIM)
|
||||
add_custom_target(big_resources_${outfilename} ALL DEPENDS ${tmpoutfile})
|
||||
_qt_internal_set_source_file_generated(SOURCES ${tmpoutfile} SKIP_AUTOGEN)
|
||||
_qt_internal_add_rcc_pass2(
|
||||
RESOURCE_NAME ${outfilename}
|
||||
RCC_OPTIONS ${rcc_options}
|
||||
@ -1357,8 +1350,8 @@ function(qt6_extract_metatypes target)
|
||||
# The content shouldn't be empty so we don't trigger AUTOMOC warnings about it.
|
||||
file(GENERATE OUTPUT "${dummy_out_file}" CONTENT "//")
|
||||
set_source_files_properties("${dummy_out_file}" PROPERTIES
|
||||
GENERATED TRUE
|
||||
SKIP_AUTOGEN OFF)
|
||||
_qt_internal_set_source_file_generated(SOURCES "${dummy_out_file}")
|
||||
target_sources("${target}" PRIVATE "${dummy_out_file}")
|
||||
endif()
|
||||
|
||||
@ -1483,13 +1476,9 @@ function(qt6_extract_metatypes target)
|
||||
)
|
||||
endif()
|
||||
|
||||
# We can't rely on policy CMP0118 since user project controls it
|
||||
set(scope_args)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(scope_args TARGET_DIRECTORY ${target})
|
||||
endif()
|
||||
set_source_files_properties(${metatypes_file_gen} ${metatypes_file} ${scope_args}
|
||||
PROPERTIES GENERATED TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${metatypes_file_gen} ${metatypes_file}
|
||||
TARGET_DIRECTORY ${target}
|
||||
)
|
||||
|
||||
# We still need to add this file as a source of the target, otherwise the file
|
||||
@ -1768,11 +1757,6 @@ END
|
||||
target_link_libraries(${target} PRIVATE $<TARGET_OBJECTS:${target}_rc>)
|
||||
endif()
|
||||
|
||||
set(scope_args)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(scope_args TARGET_DIRECTORY ${end_target})
|
||||
endif()
|
||||
|
||||
while(outputs)
|
||||
list(POP_FRONT cfgs cfg)
|
||||
list(POP_FRONT outputs output)
|
||||
@ -1782,10 +1766,14 @@ END
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${input}" "${output}"
|
||||
VERBATIM
|
||||
)
|
||||
# We can't rely on policy CMP0118 since user project controls it
|
||||
set_source_files_properties(${output} ${scope_args} PROPERTIES
|
||||
GENERATED TRUE
|
||||
COMPILE_FLAGS "${extra_rc_flags}"
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${output}
|
||||
TARGET_DIRECTORY ${end_target}
|
||||
)
|
||||
set_source_files_properties(${output}
|
||||
TARGET_DIRECTORY ${end_target}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${extra_rc_flags}"
|
||||
)
|
||||
target_sources(${end_target} PRIVATE "$<$<CONFIG:${cfg}>:${output}>")
|
||||
endwhile()
|
||||
@ -1828,11 +1816,8 @@ function(_qt_internal_generate_longpath_win32_rc_file_and_manifest target)
|
||||
endif()
|
||||
list(APPEND outputs "${mn_file_output}")
|
||||
|
||||
foreach(output IN LISTS outputs)
|
||||
# Needed for CMake versions < 3.19
|
||||
set_source_files_properties(${output} PROPERTIES GENERATED TRUE)
|
||||
target_sources(${target} PRIVATE "${output}")
|
||||
endforeach()
|
||||
target_sources(${target} PRIVATE ${outputs})
|
||||
_qt_internal_set_source_file_generated(SOURCES ${outputs})
|
||||
endfunction()
|
||||
|
||||
function(__qt_get_relative_resource_path_for_file output_alias file)
|
||||
@ -2107,14 +2092,16 @@ function(__qt_internal_generate_init_resource_source_file out_var target resourc
|
||||
|
||||
configure_file("${template_file}" "${resource_init_path}" @ONLY)
|
||||
|
||||
set(scope_args "")
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(scope_args TARGET_DIRECTORY ${target})
|
||||
endif()
|
||||
set_source_files_properties(${resource_init_path} ${scope_args} PROPERTIES
|
||||
SKIP_AUTOGEN TRUE
|
||||
SKIP_UNITY_BUILD_INCLUSION TRUE
|
||||
SKIP_PRECOMPILE_HEADERS TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${resource_init_path}
|
||||
TARGET_DIRECTORY ${target}
|
||||
SKIP_AUTOGEN CONFIGURE_GENERATED
|
||||
)
|
||||
set_source_files_properties(${resource_init_path}
|
||||
TARGET_DIRECTORY ${target}
|
||||
PROPERTIES
|
||||
SKIP_UNITY_BUILD_INCLUSION TRUE
|
||||
SKIP_PRECOMPILE_HEADERS TRUE
|
||||
)
|
||||
|
||||
set(${out_var} "${resource_init_path}" PARENT_SCOPE)
|
||||
@ -2494,21 +2481,17 @@ function(_qt_internal_process_resource target resourceName)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# We can't rely on policy CMP0118 since user project controls it.
|
||||
# We also want SKIP_AUTOGEN known in the target's scope, where we can.
|
||||
set(scope_args)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
|
||||
set(scope_args TARGET_DIRECTORY ${target})
|
||||
endif()
|
||||
set_source_files_properties(${generatedOutfile} ${scope_args} PROPERTIES
|
||||
SKIP_AUTOGEN TRUE
|
||||
GENERATED TRUE
|
||||
SKIP_UNITY_BUILD_INCLUSION TRUE
|
||||
SKIP_PRECOMPILE_HEADERS TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${generatedOutfile}
|
||||
TARGET_DIRECTORY ${target}
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
set_source_files_properties(${generatedOutfile}
|
||||
TARGET_DIRECTORY ${target}
|
||||
PROPERTIES
|
||||
SKIP_UNITY_BUILD_INCLUSION TRUE
|
||||
SKIP_PRECOMPILE_HEADERS TRUE
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")
|
||||
set_source_files_properties(${generatedOutfile} ${scope_args} PROPERTIES SKIP_LINTING ON)
|
||||
endif()
|
||||
|
||||
get_target_property(target_source_dir ${target} SOURCE_DIR)
|
||||
if(NOT target_source_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
|
@ -39,9 +39,9 @@ function(qt6_add_dbus_interface _sources _interface _relativename)
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
set_source_files_properties("${_impl}" "${_header}" PROPERTIES
|
||||
SKIP_AUTOMOC TRUE
|
||||
SKIP_AUTOUIC TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES "${_impl}" "${_header}"
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
|
||||
qt6_generate_moc("${_header}" "${_moc}")
|
||||
@ -182,11 +182,11 @@ function(qt6_add_dbus_adaptor _sources _xml_file _include) # _optionalParentClas
|
||||
)
|
||||
endif()
|
||||
|
||||
qt6_generate_moc("${_header}" "${_moc}")
|
||||
set_source_files_properties("${_impl}" "${_header}" PROPERTIES
|
||||
SKIP_AUTOMOC TRUE
|
||||
SKIP_AUTOUIC TRUE
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES "${_impl}" "${_header}"
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
qt6_generate_moc("${_header}" "${_moc}")
|
||||
macro_add_file_dependencies("${_impl}" "${_moc}")
|
||||
|
||||
list(APPEND ${_sources} "${_impl}" "${_header}")
|
||||
|
@ -31,10 +31,12 @@ function(qt6_wrap_ui outfiles )
|
||||
ARGS ${ui_options} -o ${outfile} ${infile}
|
||||
MAIN_DEPENDENCY ${infile} VERBATIM)
|
||||
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOMOC ON)
|
||||
set_source_files_properties(${outfile} PROPERTIES SKIP_AUTOUIC ON)
|
||||
list(APPEND ${outfiles} ${outfile})
|
||||
endforeach()
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${${outfiles}}
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@ -197,13 +199,6 @@ function(qt6_add_ui target)
|
||||
endif()
|
||||
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
|
||||
|
||||
macro(_qt_internal_set_output_file_properties file)
|
||||
set_source_files_properties(${file} PROPERTIES
|
||||
SKIP_AUTOMOC TRUE
|
||||
SKIP_AUTOUIC TRUE
|
||||
SKIP_LINTING TRUE)
|
||||
endmacro()
|
||||
|
||||
set(outfile "${output_directory}/ui_${outfile}.h")
|
||||
# Before CMake 3.27, there was a bug when using $<CONFIG> in a generated
|
||||
# file with Ninja Multi-Config generator. To avoid this issue, we need
|
||||
@ -220,12 +215,17 @@ function(qt6_add_ui target)
|
||||
foreach(config ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(REPLACE "$<CONFIG>" "${config}" outfile_with_config
|
||||
"${outfile}")
|
||||
_qt_internal_set_output_file_properties(
|
||||
${outfile_with_config})
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${outfile_with_config}
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
target_sources(${target} PRIVATE ${outfile_with_config})
|
||||
endforeach()
|
||||
else()
|
||||
_qt_internal_set_output_file_properties(${outfile})
|
||||
_qt_internal_set_source_file_generated(
|
||||
SOURCES ${outfile}
|
||||
SKIP_AUTOGEN
|
||||
)
|
||||
target_sources(${target} PRIVATE ${outfile})
|
||||
endif()
|
||||
# remove double slashes
|
||||
|
Loading…
x
Reference in New Issue
Block a user