Add missing framework paths to header check targets

CMake doesn't add framework include paths for the includes if
add_custom_command is used. When all Qt modules are installed to a
single directory, frameworks could be found under
QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX, but for Conan builds
each module is installed to the separate directory. These directories
need to be listed in the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables
family. This takes into account directories that are listed in the
QT_ADDITIONAL_PACKAGES_PREFIX_PATH variables and considers they
can contain frameworks.

Pick-to: 6.2
Fixes: QTBUG-96511
Change-Id: I664381df4859a2e85c399cd94dc2f3996e452c03
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2021-09-20 12:41:35 +02:00
parent 766904bf5b
commit 2483931e25

View File

@ -158,6 +158,21 @@ function(qt_internal_add_headers_clean_target
# generator expression we provide, so pass it explicitly and hope for the best.
list(APPEND framework_includes
"-iframework" "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBDIR}")
# If additional package prefixes are provided, we consider they can contain frameworks
# as well.
foreach(prefix IN LISTS _qt_additional_packages_prefix_paths)
if(prefix MATCHES "/lib/cmake$") # Cut CMake files path
string(APPEND prefix "/../..")
endif()
get_filename_component(prefix "${prefix}" ABSOLUTE)
set(libdir "${prefix}/${INSTALL_LIBDIR}")
if(EXISTS "${libdir}")
list(APPEND framework_includes
"-iframework" "${libdir}")
endif()
endforeach()
endif()
foreach(header ${hclean_headers})