Do not make extra copy of public headers for external headers module

Cmake install(TARGET) copies public and private headers even
if DESTINATION is unset, therefore add workaround and remove
public headers before the install call.

Note the reason we do not need this copy is that we install those
headers with install(DIRECTORY) to keep the directory structure as it
is required for example by freefont.

Fixes: QTBUG-104856
Change-Id: I494935d01163cee4f2f19b95aec97f5fd7a12f84
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 40e844918a64f1c9aa3c8293158f15755bcab5fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Michal Klocek 2022-08-26 12:38:44 +02:00 committed by Qt Cherry-pick Bot
parent 766d71ef71
commit 257d4c93c7

View File

@ -708,9 +708,8 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
qt_install(DIRECTORY "${arg_EXTERNAL_HEADERS_DIR}/"
DESTINATION "${module_install_interface_include_dir}"
)
unset(public_header_destination)
else()
set(public_header_destination PUBLIC_HEADER DESTINATION "${module_install_interface_include_dir}")
get_target_property(public_header_backup ${target} PUBLIC_HEADER)
set_property(TARGET ${target} PROPERTY PUBLIC_HEADER "")
endif()
qt_install(TARGETS ${exported_targets}
@ -720,8 +719,12 @@ set(QT_LIBINFIX \"${QT_LIBINFIX}\")")
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${INSTALL_LIBDIR}
PRIVATE_HEADER DESTINATION "${module_install_interface_private_include_dir}"
${public_header_destination}
)
PUBLIC_HEADER DESTINATION "${module_install_interface_include_dir}"
)
if(arg_EXTERNAL_HEADERS_DIR)
set_property(TARGET ${target} PROPERTY PUBLIC_HEADER ${public_header_backup})
unset(public_header_backup)
endif()
if(BUILD_SHARED_LIBS)
qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_LIBDIR}" RELATIVE_RPATH)