Avoid syncing and installation of non-module headers
Add CMake rules to skip syncing and installation of header files that are recognized as non-module. Previously these rules were in syncqt.cpp only and CMake ignored them when creating the installation rules. Now we skip any post processing for the header files that: - are public and located in the '3rdparty' directory unless the module is the 3rdparty one - are not a part of the module source tree unless they are generated - have the _qt_non_module_header property set to TRUE Pick-to: 6.5 Change-Id: I045cfc2b8074f0c086c975aae95f14845e3edfef Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
7477dec2d4
commit
4105ff809c
@ -1206,6 +1206,17 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
|
||||
qt_internal_get_target_sources(sources ${target})
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
else()
|
||||
get_target_property(source_dir ${target} SOURCE_DIR)
|
||||
endif()
|
||||
get_filename_component(source_dir "${source_dir}" ABSOLUTE)
|
||||
get_filename_component(source_dir "${source_dir}" REALPATH)
|
||||
|
||||
get_target_property(is_3rdparty_library ${target} _qt_module_is_3rdparty_header_library)
|
||||
|
||||
get_target_property(public_filter ${target} _qt_module_public_headers_filter_regex)
|
||||
get_target_property(private_filter ${target} _qt_module_private_headers_filter_regex)
|
||||
get_target_property(qpa_filter ${target} _qt_module_qpa_headers_filter_regex)
|
||||
@ -1216,6 +1227,28 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
if(NOT file_name MATCHES ".+\\.h$")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
get_source_file_property(non_module_header ${file_path} _qt_non_module_header)
|
||||
if(non_module_header)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
get_filename_component(file_path "${file_path}" ABSOLUTE)
|
||||
get_filename_component(file_path "${file_path}" REALPATH)
|
||||
|
||||
string(FIND "${file_path}" "${source_dir}" source_dir_pos)
|
||||
if(source_dir_pos EQUAL 0)
|
||||
set(is_outside_module_source_dir FALSE)
|
||||
else()
|
||||
set(is_outside_module_source_dir TRUE)
|
||||
endif()
|
||||
|
||||
get_source_file_property(is_generated "${file_path}" GENERATED)
|
||||
# Skip all header files outside the module source directory, except the generated files.
|
||||
if(is_outside_module_source_dir AND NOT is_generated)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
get_source_file_property(condition ${file_path} _qt_extend_target_condition)
|
||||
if(NOT condition STREQUAL "" AND NOT condition STREQUAL "NOTFOUND")
|
||||
list(JOIN condition " " condition_string)
|
||||
@ -1224,15 +1257,18 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
"\nCondition:\n ${condition_string}")
|
||||
endif()
|
||||
|
||||
get_source_file_property(is_generated "${file_path}" GENERATED)
|
||||
get_filename_component(file_path "${file_path}" ABSOLUTE)
|
||||
get_filename_component(file_path "${file_path}" REALPATH)
|
||||
if(file_path MATCHES "3rdparty/.+" AND NOT is_3rdparty_library)
|
||||
set(is_3rdparty_header TRUE)
|
||||
else()
|
||||
set(is_3rdparty_header FALSE)
|
||||
endif()
|
||||
list(APPEND ${out_var}_all "${file_path}")
|
||||
if(qpa_filter AND file_name MATCHES "${qpa_filter}")
|
||||
list(APPEND ${out_var}_qpa "${file_path}")
|
||||
elseif(private_filter AND file_name MATCHES "${private_filter}")
|
||||
list(APPEND ${out_var}_private "${file_path}")
|
||||
elseif(NOT public_filter OR file_name MATCHES "${public_filter}")
|
||||
elseif((NOT public_filter OR file_name MATCHES "${public_filter}")
|
||||
AND NOT is_3rdparty_header)
|
||||
list(APPEND ${out_var}_public "${file_path}")
|
||||
endif()
|
||||
if(is_generated)
|
||||
|
Loading…
Reference in New Issue
Block a user