From 270315e019a569bebf83e7c293b44f36c555fb3c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 19 Mar 2024 11:34:15 +0100 Subject: [PATCH] CMake: Fix finding standalone parts config file for yocto When building standalone tests of qtsvg targeting yocto, the standalone parts config file was not found. That's because it specifies a new CMAKE_STAGING_PREFIX for each built repo, and the QtSvgTestsConfig.cmake file will be located there, rather than in QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX, where the QtBuildInternalsConfig.cmake file is. So in this case, we always have to prefer looking into CMAKE_STAGING_PREFIX for the file. Amends 62905163bf887c2c2c9ba7edcd64c96d237a6e95 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: I8902381afa4267e40dfb2ad47e44285a806a35e2 Reviewed-by: Alexey Edelev --- cmake/QtBuildRepoHelpers.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuildRepoHelpers.cmake b/cmake/QtBuildRepoHelpers.cmake index 9c30b6793e7..16b26545692 100644 --- a/cmake/QtBuildRepoHelpers.cmake +++ b/cmake/QtBuildRepoHelpers.cmake @@ -497,7 +497,15 @@ function(qt_get_standalone_parts_config_files_path out_var) set(dir_name "StandaloneTests") set(path_suffix "${INSTALL_LIBDIR}/cmake/${INSTALL_CMAKE_NAMESPACE}BuildInternals/${dir_name}") - set(path "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${path_suffix}") + + # Each repo's standalone parts might be configured with a unique CMAKE_STAGING_PREFIX, + # different from any previous one, and it might not coincide with where the BuildInternals + # config file is. + if(QT_WILL_INSTALL AND CMAKE_STAGING_PREFIX) + qt_path_join(path "${CMAKE_STAGING_PREFIX}" "${path_suffix}") + else() + qt_path_join(path "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}" "${path_suffix}") + endif() set("${out_var}" "${path}" PARENT_SCOPE) endfunction()