Add NO_HEADERSCLEAN_CHECK flag to qt_internal_add_module

Some modules may have header files that do not pass headersclean check
under some conditions. It's nice to have an option in the
qt_internal_add_module function to disable the check for the modules of
this kind. At the moment this flag is useful for the ActiveQt module,
since it syncs and installs header files that don't belong to it.

Amends b89d63515bb352cecfd87e709320a2db5b6a1906

Task-number: QTBUG-103196
Change-Id: I21a82d50d50bdac225ed483ab0cc50339c2a4873
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2022-10-24 18:35:12 +02:00
parent 626ebf4738
commit 433d711670
3 changed files with 12 additions and 7 deletions

View File

@ -5,8 +5,8 @@
# ${module_headers} with a custom set of defines. This makes sure our public headers
# are self-contained, and also compile with more strict compiler options.
function(qt_internal_add_headersclean_target module_target module_headers)
get_target_property(has_headers ${module_target} _qt_module_has_headers)
if(NOT has_headers)
get_target_property(no_headersclean_check ${module_target} _qt_no_headersclean_check)
if(no_headersclean_check)
return()
endif()

View File

@ -15,6 +15,7 @@ macro(qt_internal_get_internal_add_module_keywords option_args single_args multi
NO_CONFIG_HEADER_FILE
NO_ADDITIONAL_TARGET_INFO
NO_GENERATE_METATYPES
NO_HEADERSCLEAN_CHECK
GENERATE_CPP_EXPORTS # TODO: Rename to NO_GENERATE_CPP_EXPORTS once migration is done
GENERATE_METATYPES # TODO: Remove once it is not used anymore
GENERATE_PRIVATE_CPP_EXPORTS
@ -490,6 +491,11 @@ function(qt_internal_add_module target)
endif()
endif()
if(arg_NO_HEADERSCLEAN_CHECK OR arg_NO_MODULE_HEADERS OR arg_NO_SYNC_QT
OR NOT QT_FEATURE_headersclean)
set_target_properties("${target}" PROPERTIES _qt_no_headersclean_check ON)
endif()
if(NOT arg_HEADER_MODULE)
# Plugin types associated to a module
if(NOT "x${arg_PLUGIN_TYPES}" STREQUAL "x")
@ -876,7 +882,7 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
endif()
endif()
if(QT_FEATURE_headersclean AND NOT arg_NO_MODULE_HEADERS AND NOT QT_USE_SYNCQT_CPP)
if(NOT QT_USE_SYNCQT_CPP)
qt_internal_add_headersclean_target(
${target}
"${module_headers_clean}")
@ -918,9 +924,7 @@ function(qt_finalize_module target)
# property which supposed to be updated inside every qt_internal_install_module_headers
# call.
if(QT_USE_SYNCQT_CPP)
if(QT_FEATURE_headersclean)
qt_internal_add_headersclean_target(${target} "${module_headers_public}")
endif()
qt_internal_target_sync_headers(${target} "${module_headers_all}"
"${module_headers_generated}")
get_target_property(module_depends_header ${target} _qt_module_depends_header)

View File

@ -257,7 +257,8 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
set(non_qt_module_argument "-nonQt")
else()
list(APPEND syncqt_outputs "${module_build_interface_include_dir}/${module}")
if(QT_FEATURE_headersclean)
get_target_property(no_headersclean_check ${target} _qt_no_headersclean_check)
if(NOT no_headersclean_check)
list(APPEND syncqt_outputs
"${CMAKE_CURRENT_BINARY_DIR}/${module}_header_check_exceptions")
endif()