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 <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2024-03-19 11:34:15 +01:00
parent 8ed8844343
commit 270315e019

View File

@ -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()