From a848d208804dadc18ef03e5dc1b78a845b230aa9 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 25 Mar 2025 11:52:23 +0100 Subject: [PATCH] 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 e552513c9f4d5cf3ab31be4a6bf72462a965b6e1 Change-Id: If804bcb36a0bd3df6e4617e56c146094793138c4 Reviewed-by: Alexey Edelev --- tests/manual/RunCMake/CMakeLists.txt | 2 +- tests/manual/RunCMake/Common.cmake | 16 ++++++++++++---- .../RunCMake/InitRepository/RunCMakeTest.cmake | 6 ++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/manual/RunCMake/CMakeLists.txt b/tests/manual/RunCMake/CMakeLists.txt index f3ade5f8..8510e81a 100644 --- a/tests/manual/RunCMake/CMakeLists.txt +++ b/tests/manual/RunCMake/CMakeLists.txt @@ -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} ) diff --git a/tests/manual/RunCMake/Common.cmake b/tests/manual/RunCMake/Common.cmake index 63418cfd..5a5cfa47 100644 --- a/tests/manual/RunCMake/Common.cmake +++ b/tests/manual/RunCMake/Common.cmake @@ -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() diff --git a/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake b/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake index a83b192e..bb18bd1a 100644 --- a/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake +++ b/tests/manual/RunCMake/InitRepository/RunCMakeTest.cmake @@ -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)