Fix qtbase cmake autotest

The testcase relied on having optional packages, and that the last
package in that list was found. Otherwise the version numbers of
the found modules were not set.

Change-Id: I76743fd029d6eed2f4b347280591e6fdaed19053
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Juha Vuolle 2021-04-19 11:41:01 +03:00
parent 76537c065a
commit ed72147149

View File

@ -69,13 +69,10 @@ find_package(Qt6 REQUIRED COMPONENTS ${required_packages})
find_package(Qt6 OPTIONAL_COMPONENTS ${optional_packages}) find_package(Qt6 OPTIONAL_COMPONENTS ${optional_packages})
# Setup common test variables which were previously set by ctest_testcase_common.prf. # Setup common test variables which were previously set by ctest_testcase_common.prf.
set(CMAKE_MODULES_UNDER_TEST "${required_packages}") set(CMAKE_MODULES_UNDER_TEST "${required_packages}" ${optional_packages})
foreach(qt_package ${optional_packages})
set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}")
list(APPEND CMAKE_MODULES_UNDER_TEST "${qt_package}")
endforeach()
foreach(qt_package ${CMAKE_MODULES_UNDER_TEST}) foreach(qt_package ${CMAKE_MODULES_UNDER_TEST})
set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}")
if(${package_name}_FOUND) if(${package_name}_FOUND)
set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}") set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}")
set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}") set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}")