-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Allow usage of QtStandaloneTestTemplateProject as package comp…
…onent Currently in order to compile a Qt6 test standalone one needs to use the qt-cmake-standalone-test script which will load the Qt6BuildInternals/QtStandaloneTestTemplateProject/CMakeLists.txt project with the current test source directory to create a complete CMake project. This commit will allow a test to have these lines at top: cmake_minimum_required(VERSION 3.16) if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) project(a_qt_test LANGUAGES C CXX ASM) find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) endif() and be standalone and work with any IDE capable of loading CMake projects. Fixes: QTCREATORBUG-25389 Pick-to: 6.1 Change-Id: If3f878b7e560a8bfbb604a8f1aa30b7962742e66 Reviewed-by: Alexandru Croitor <[email protected]>
- Loading branch information
1 parent
66acee6
commit 0a1256a
Showing
5 changed files
with
47 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@__qt_cmake_standalone_test_os_prelude@ | ||
|
||
@__qt_cmake_standalone_test_script_relpath@ | ||
@__qt_cmake_private_relpath@ @__qt_cmake_standalone_test_relpath@ -DQT_STANDALONE_TEST_PATH=@__qt_cmake_standalone_passed_args@ | ||
@__qt_cmake_private_relpath@ @__qt_cmake_standalone_test_relpath@ -DQT_BUILD_STANDALONE_TESTS=ON -DQT_STANDALONE_TEST_PATH=@__qt_cmake_standalone_passed_args@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
cmake/QtBuildInternals/QtStandaloneTestTemplateProject/Main.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Includes QtSetup and friends for private CMake API. | ||
qt_build_internals_set_up_private_api() | ||
|
||
# Find all StandaloneTestsConfig.cmake files, and include them | ||
# This will find all Qt packages that are required for standalone tests. | ||
# It will find more packages that needed for a certain test, but will ensure any test can | ||
# be built. | ||
qt_get_standalone_tests_confg_files_path(standalone_tests_config_path) | ||
|
||
file(GLOB config_files "${standalone_tests_config_path}/*") | ||
foreach(file ${config_files}) | ||
include("${file}") | ||
endforeach() | ||
|
||
# Just before adding the test, change the local (non-cache) install prefix to something other than | ||
# the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix. | ||
# Needs to be called after qt_get_standalone_tests_confg_files_path(). | ||
qt_set_up_fake_standalone_tests_install_prefix() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters