CMake: Add INSTALL_DIR argument to qt_internal_add_app

Add the possibility to install a Qt app into a directory different from
${INSTALL_BINDIR}.

If INSTALL_DIR is not specified, qt_internal_add_app still installs to
${INSTALL_BINDIR}.

Pick-to: 6.2 6.3
Task-number: QTBUG-99295
Task-number: QTBUG-100047
Change-Id: I52371aa0f770d80c32bb0b3442ce3c463916be63
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2022-02-22 13:49:24 +01:00
parent 330f2132ca
commit d48609a9c4

View File

@ -4,11 +4,17 @@ function(qt_internal_add_app target)
qt_parse_all_arguments(arg
"qt_internal_add_app"
"NO_INSTALL;INSTALL_VERSIONED_LINK"
"${__default_target_info_args}"
"${__default_target_info_args};INSTALL_DIR"
"${__default_private_args}"
${ARGN})
set(output_directory "${QT_BUILD_DIR}/${INSTALL_BINDIR}")
if(DEFINED arg_INSTALL_DIR)
set(forward_install_dir INSTALL_DIRECTORY ${arg_INSTALL_DIR})
else()
set(forward_install_dir "")
set(arg_INSTALL_DIR ${INSTALL_BINDIR})
endif()
set(output_directory "${QT_BUILD_DIR}/${arg_INSTALL_DIR}")
set(no_install "")
if(arg_NO_INSTALL)
@ -21,6 +27,7 @@ function(qt_internal_add_app target)
DELAY_TARGET_INFO
OUTPUT_DIRECTORY "${output_directory}"
${no_install}
${forward_install_dir}
SOURCES ${arg_SOURCES}
INCLUDE_DIRECTORIES
${arg_INCLUDE_DIRECTORIES}
@ -55,7 +62,7 @@ function(qt_internal_add_app target)
# Install versioned link if requested.
if(NOT arg_NO_INSTALL AND arg_INSTALL_VERSIONED_LINK)
qt_internal_install_versioned_link("${INSTALL_BINDIR}" ${target})
qt_internal_install_versioned_link("${arg_INSTALL_DIR}" ${target})
endif()
qt_add_list_file_finalizer(qt_internal_finalize_app ${target})