CMake: Adjust to new location of RunCMakeTestHelpers in qtbase

Adjust the path to where expect to find the QtRunCMakeTestHelpers
module in qtbase.

Replace the usage of 'QtIRRunCMake' with 'RunCMake' in the root test
CMakeLists.txt.

Pass the current source dir as an extra module path to the RunCMake
test, so it can find the Common module without relying on relative
paths, so that any build dir works.

Remove the unnecessary forwarding of CMAKE_SYSTEM_NAME.

Amends e552513c9f

Change-Id: If804bcb36a0bd3df6e4617e56c146094793138c4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2025-03-25 11:52:23 +01:00
parent 04771d15e7
commit a848d20880
3 changed files with 17 additions and 7 deletions

View File

@ -8,5 +8,5 @@ enable_testing()
include("${CMAKE_CURRENT_SOURCE_DIR}/Common.cmake")
add_RunCMake_test(InitRepository
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DEXTRA_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -3,9 +3,17 @@
set(top_repo_dir_path "${CMAKE_CURRENT_LIST_DIR}/../../..")
get_filename_component(top_repo_dir_path "${top_repo_dir_path}" ABSOLUTE)
if(NOT IS_DIRECTORY ${top_repo_dir_path}/qtbase/cmake/3rdparty/cmake)
set(qtbase_path "${top_repo_dir_path}/qtbase")
set(run_cmake_path "${qtbase_path}/src/testinternal/3rdparty/cmake")
if(NOT IS_DIRECTORY "${qtbase_path}")
message(FATAL_ERROR
"qtbase submodule is not initialized or it is missing the QtRunCMakeTestHelpers.\n"
"qtbase submodule is not initialized.\n"
" Cannot run these tests without them."
)
endif()
if(NOT IS_DIRECTORY "${run_cmake_path}")
message(FATAL_ERROR
"qtbase submodule is missing the QtRunCMakeTestHelpers at ${run_cmake_path}.\n"
" Cannot run these tests without them."
)
endif()
@ -14,11 +22,11 @@ macro(qt_ir_setup_test_include_paths)
set(ir_script_path "${top_repo_dir_path}/cmake")
list(APPEND CMAKE_MODULE_PATH
"${ir_script_path}"
"${top_repo_dir_path}/qtbase/cmake/3rdparty/cmake"
"${run_cmake_path}"
)
include(QtIRHelpers)
qt_ir_include_all_helpers()
# RunCMakeTestHelpers from qtbase/cmake/3rdparty/cmake
# RunCMakeTestHelpers from qtbase/src/testinternal/3rdparty/cmake
include(QtRunCMakeTestHelpers)
endmacro()
qt_ir_setup_test_include_paths()

View File

@ -2,11 +2,13 @@
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
include("${CMAKE_CURRENT_SOURCE_DIR}/../Common.cmake")
list(APPEND CMAKE_MODULE_PATH "${EXTRA_MODULE_PATH}")
include(Common)
# The file is included separately from Common.cmake because it has side-effects
# that we want to apply only in the RunCMake part of the test.
include(QtIRRunCMake)
include(RunCMake)
# Uses prefix set from outside scope.
function(run_suite_command name)