diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake index 662b6be581c..941b6d74ef1 100644 --- a/cmake/QtBuildHelpers.cmake +++ b/cmake/QtBuildHelpers.cmake @@ -444,6 +444,7 @@ macro(qt_internal_setup_build_and_global_variables) qt_internal_setup_build_examples() qt_internal_set_qt_host_path() + qt_internal_setup_find_host_info_package() qt_internal_setup_build_docs() @@ -465,7 +466,6 @@ macro(qt_internal_setup_build_and_global_variables) qt_internal_check_msvc_versions() qt_internal_check_host_path_set_for_cross_compiling() qt_internal_setup_android_platform_specifics() - qt_internal_setup_find_host_info_package() qt_internal_setup_tool_path_command() qt_internal_setup_default_target_function_options() qt_internal_set_default_rpath_settings() diff --git a/cmake/QtBuildPathsHelpers.cmake b/cmake/QtBuildPathsHelpers.cmake index be2e26bc4a0..b011b905fe9 100644 --- a/cmake/QtBuildPathsHelpers.cmake +++ b/cmake/QtBuildPathsHelpers.cmake @@ -263,3 +263,20 @@ macro(qt_internal_setup_paths_and_prefixes) qt_internal_set_qt_apple_support_files_path() endmacro() + +# Returns the prefix for the variables defined by HostInfo package. The prefix +# is based on version information provided by HostInfo. Falls back to current +# project version if ${INSTALL_CMAKE_NAMESPACE}HostInfo_VERSION_MAJOR is not +# defined. +function(qt_internal_get_host_info_var_prefix out_var) + if(${INSTALL_CMAKE_NAMESPACE}HostInfo_VERSION_MAJOR) + set(${out_var} "QT${${INSTALL_CMAKE_NAMESPACE}HostInfo_VERSION_MAJOR}_HOST_INFO" + PARENT_SCOPE) + else() + # This is not a valid way to define the host info versioned prefix, but + # it's backward compatible with Qt versions older than 6.10. + # + # TODO: remove once Qt LTS versions older than 6.10 reach end of life. + set(${out_var} "QT${PROJECT_VERSION_MAJOR}_HOST_INFO" PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/QtDocsHelpers.cmake b/cmake/QtDocsHelpers.cmake index 2df526ad8bb..6699ecc0620 100644 --- a/cmake/QtDocsHelpers.cmake +++ b/cmake/QtDocsHelpers.cmake @@ -131,8 +131,9 @@ function(qt_internal_add_docs) set(tool_dependencies_enabled TRUE) if(NOT "${QT_HOST_PATH}" STREQUAL "") set(tool_dependencies_enabled FALSE) - set(doc_tools_bin "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}") - set(doc_tools_libexec "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) + set(doc_tools_bin "${QT_HOST_PATH}/${${host_info_var_prefix}_BINDIR}") + set(doc_tools_libexec "${QT_HOST_PATH}/${${host_info_var_prefix}_LIBEXECDIR}") elseif(NOT "${QT_OPTIONAL_TOOLS_PATH}" STREQUAL "") set(tool_dependencies_enabled FALSE) set(doc_tools_bin "${QT_OPTIONAL_TOOLS_PATH}/${INSTALL_BINDIR}") diff --git a/cmake/QtMkspecHelpers.cmake b/cmake/QtMkspecHelpers.cmake index a9612966b5f..a7f239f1b6d 100644 --- a/cmake/QtMkspecHelpers.cmake +++ b/cmake/QtMkspecHelpers.cmake @@ -114,7 +114,8 @@ macro(qt_internal_setup_platform_definitions_and_mkspec) endif() if(CMAKE_CROSSCOMPILING) - set(QT_QMAKE_HOST_MKSPEC "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_QMAKE_MKSPEC}") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) + set(QT_QMAKE_HOST_MKSPEC "${${host_info_var_prefix}_QMAKE_MKSPEC}") else() set(QT_QMAKE_HOST_MKSPEC "${QT_QMAKE_TARGET_MKSPEC}") endif() diff --git a/cmake/QtPlatformAndroid.cmake b/cmake/QtPlatformAndroid.cmake index 1ded0197205..62f0b93c75c 100644 --- a/cmake/QtPlatformAndroid.cmake +++ b/cmake/QtPlatformAndroid.cmake @@ -136,8 +136,10 @@ define_property(TARGET # Returns test execution arguments for Android targets function(qt_internal_android_test_runner_arguments target out_test_runner out_test_arguments) - set(${out_test_runner} "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androidtestrunner" PARENT_SCOPE) - set(deployment_tool "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androiddeployqt") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) + set(host_bin_dir "${QT_HOST_PATH}/${${host_info_var_prefix}_BINDIR}") + set(${out_test_runner} "${host_bin_dir}/androidtestrunner" PARENT_SCOPE) + set(deployment_tool "${host_bin_dir}/androiddeployqt") qt_internal_android_get_target_android_build_dir(${target} android_build_dir) set(${out_test_arguments} diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake index 7b023af6e3c..b450681d61c 100644 --- a/cmake/QtPriHelpers.cmake +++ b/cmake/QtPriHelpers.cmake @@ -738,9 +738,10 @@ function(qt_generate_global_config_pri_file) endif() if(CMAKE_CROSSCOMPILING) + qt_internal_get_host_info_var_prefix(host_info_var_prefix) string(APPEND content "host_build { - QT_ARCH = ${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_ARCH} - QT_BUILDABI = ${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BUILDABI} + QT_ARCH = ${${host_info_var_prefix}_ARCH} + QT_BUILDABI = ${${host_info_var_prefix}_BUILDABI} QT_TARGET_ARCH = ${TEST_architecture_arch} QT_TARGET_BUILDABI = ${TEST_buildAbi} } else { @@ -965,8 +966,9 @@ function(qt_generate_global_module_pri_file) set(arch "${TEST_architecture_arch}") list(JOIN TEST_subarch_result " " subarchs) if(CMAKE_CROSSCOMPILING) - set(host_arch "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_ARCH}") - list(JOIN QT${PROJECT_VERSION_MAJOR}_HOST_INFO_SUBARCHS " " host_subarchs) + qt_internal_get_host_info_var_prefix(host_info_var_prefix) + set(host_arch "${${host_info_var_prefix}_ARCH}") + list(JOIN ${host_info_var_prefix}_SUBARCHS " " host_subarchs) string(APPEND content "host_build { QT_CPU_FEATURES.${host_arch} = ${host_subarchs} } else { diff --git a/cmake/QtQmakeHelpers.cmake b/cmake/QtQmakeHelpers.cmake index c618fa05109..c1dbb0d542d 100644 --- a/cmake/QtQmakeHelpers.cmake +++ b/cmake/QtQmakeHelpers.cmake @@ -125,6 +125,7 @@ Prefix=${prefix} endif() endif() + qt_internal_get_host_info_var_prefix(host_info_var_prefix) string(APPEND content "[Paths] Prefix=${ext_prefix_relative_to_conf_file} @@ -142,9 +143,9 @@ Examples=${INSTALL_EXAMPLESDIR} Tests=${INSTALL_TESTSDIR} Settings=${INSTALL_SYSCONFDIR} HostPrefix=${host_prefix_relative_to_conf_file} -HostBinaries=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR} -HostLibraries=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBDIR} -HostLibraryExecutables=${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR} +HostBinaries=${${host_info_var_prefix}_BINDIR} +HostLibraries=${${host_info_var_prefix}_LIBDIR} +HostLibraryExecutables=${${host_info_var_prefix}_LIBEXECDIR} HostData=${ext_datadir_relative_to_host_prefix} Sysroot=${sysroot} SysrootifyPrefix=${sysrootify_prefix} @@ -169,7 +170,7 @@ HostSpec=${QT_QMAKE_HOST_MKSPEC} set(wrapper_prefix "host-") endif() - set(host_qt_bindir "${host_prefix}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}") + set(host_qt_bindir "${host_prefix}/${${host_info_var_prefix}_BINDIR}") file(TO_NATIVE_PATH "${host_qt_bindir}" host_qt_bindir) if(QT_CREATE_VERSIONED_HARD_LINK AND QT_WILL_INSTALL) diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index 658239628d2..43c27f9f910 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -1239,9 +1239,10 @@ function(qt_internal_create_tracepoints name tracepoints_file) endif() if(NOT "${QT_HOST_PATH}" STREQUAL "") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) qt_path_join(tracegen "${QT_HOST_PATH}" - "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}" + "${${host_info_var_prefix}_LIBEXECDIR}" "tracegen") else() set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen") @@ -1276,9 +1277,10 @@ function(qt_internal_generate_tracepoints name provider) endforeach() if(NOT "${QT_HOST_PATH}" STREQUAL "") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) qt_path_join(tracepointgen "${QT_HOST_PATH}" - "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}" + "${${host_info_var_prefix}_LIBEXECDIR}" "tracepointgen") else() set(tracepointgen "${QT_CMAKE_EXPORT_NAMESPACE}::tracepointgen") @@ -1309,9 +1311,10 @@ function(qt_internal_generate_tracepoints name provider) endif() if(NOT "${QT_HOST_PATH}" STREQUAL "") + qt_internal_get_host_info_var_prefix(host_info_var_prefix) qt_path_join(tracegen "${QT_HOST_PATH}" - "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}" + "${${host_info_var_prefix}_LIBEXECDIR}" "tracegen") else() set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen") diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index cd4f6c8d2df..25e3f210d17 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -961,9 +961,10 @@ if (QT_FEATURE_vulkan) if(CMAKE_HOST_WIN32) set(host_executable_suffix ".exe") endif() + qt_internal_get_host_info_var_prefix(host_info_var_prefix) qt_path_join(qvkgen "${QT_HOST_PATH}" - "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}" + "${${host_info_var_prefix}_LIBEXECDIR}" "qvkgen${host_executable_suffix}") elseif(QT_OPTIONAL_TOOLS_PATH) qt_path_join(qvkgen