diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-01 11:48:23 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-11-08 15:42:32 +0000 |
commit | de3a806def4b9a754825a2233c9d4952a9b2d0eb (patch) | |
tree | 499fe14eff3b255f943ece94551eb58619a346c0 | |
parent | c1ba9bb72a3eeb0bd707e609da156798c51c17f0 (diff) |
Make standalone tests build via top level repo project
Previously repo/tests/CMakeLists.txt was a standalone project on which
CMake could be called. This was useful for Coin to be able to build
and package only tests, but was a bit troublesome because that means
having to specify the usual boilerplate like minimum CMake version,
which packages to find in every tests.pro project.
Instead of having a separate standalone project, modify the top level
project and associated CMake code to allow passing a special
QT_BUILD_STANDALONE_TESTS variable, which causes the top level project
to build only tests, and find Qt in the previously installed qt
location.
This also means that when building a repo, we generate a
${repo_name}TestsConfig.cmake file which does find_package on all the
modules that have been built as part of that repo. So that when
standalone tests bare built for that repo, the modules are
automatically found.
qt_set_up_standalone_tests_build() is modified to be a no-op because
it is not needed anymore. Its usage should be removed from all the
other repos, and then removed from qtbase.
Non-adjusted tests/CMakeLists.txt projects in other repositories
should still be buildable with the current code, until they are updated
to the new format.
Adjust the Coin build instructions to build the standalone tests in a
separate directory.
Adjust pro2cmake to generate new structure for the tests/tests.pro
projects.
Adjust the qtbase tests project.
Fixes: QTBUG-79239
Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | CMakeLists.txt | 97 | ||||
-rw-r--r-- | cmake/QtAutoDetect.cmake | 11 | ||||
-rw-r--r-- | cmake/QtBuildInternals/QtBuildInternalsConfig.cmake | 93 | ||||
-rw-r--r-- | cmake/QtPostProcess.cmake | 27 | ||||
-rw-r--r-- | cmake/QtSetup.cmake | 10 | ||||
-rw-r--r-- | cmake/QtStandaloneTestsConfig.cmake.in | 2 | ||||
-rw-r--r-- | coin/instructions/cmake_build_and_upload_test_artifacts.yaml | 23 | ||||
-rw-r--r-- | coin/instructions/cmake_regular_test_instructions.yaml | 8 | ||||
-rw-r--r-- | tests/.prev_CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 20 | ||||
-rwxr-xr-x | util/cmake/pro2cmake.py | 9 |
11 files changed, 184 insertions, 123 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 273a169aee..bb3cedc953 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,68 +10,75 @@ project(QtBase LANGUAGES CXX C ASM ) -## Add some paths to check for cmake modules: -list(PREPEND CMAKE_MODULE_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rdparty/extra-cmake-modules/find-modules" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rdparty/kwin" -) +if(NOT QT_BUILD_STANDALONE_TESTS) + ## Add some paths to check for cmake modules: + list(PREPEND CMAKE_MODULE_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rdparty/extra-cmake-modules/find-modules" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/3rdparty/kwin" + ) + + ## Find the build internals package. + set(QT_BUILD_INTERNALS_SKIP_CMAKE_MODULE_PATH_ADDITION TRUE) + list(PREPEND CMAKE_PREFIX_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + ) + find_package(QtBuildInternals CMAKE_FIND_ROOT_PATH_BOTH) + unset(QT_BUILD_INTERNALS_SKIP_CMAKE_MODULE_PATH_ADDITION) +else() + # When building standalone tests, an istalled BuildInternals package already exists. + find_package(Qt6 REQUIRED COMPONENTS BuildInternals CMAKE_FIND_ROOT_PATH_BOTH) +endif() -## Find the build internals package. -set(QT_BUILD_INTERNALS_SKIP_CMAKE_MODULE_PATH_ADDITION TRUE) -list(PREPEND CMAKE_PREFIX_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/cmake" -) -find_package(QtBuildInternals CMAKE_FIND_ROOT_PATH_BOTH) -unset(QT_BUILD_INTERNALS_SKIP_CMAKE_MODULE_PATH_ADDITION) qt_build_repo_begin() -## Should this Qt be static or dynamically linked? -option(BUILD_SHARED_LIBS "Build Qt statically or dynamically" ON) -set(QT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) - -## Should this Qt be built with Werror? -option(WARNINGS_ARE_ERRORS "Build Qt with warnings as errors" ${FEATURE_developer_build}) +if(NOT QT_BUILD_STANDALONE_TESTS) + ## Should this Qt be static or dynamically linked? + option(BUILD_SHARED_LIBS "Build Qt statically or dynamically" ON) + set(QT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) -## Should Qt be built using PCH? -option(BUILD_WITH_PCH "Build Qt using precompiled headers?" ON) + ## Should this Qt be built with Werror? + option(WARNINGS_ARE_ERRORS "Build Qt with warnings as errors" ${FEATURE_developer_build}) -## QtBase specific configure tests: -include(QtBaseConfigureTests) + ## Should Qt be built using PCH? + option(BUILD_WITH_PCH "Build Qt using precompiled headers?" ON) -## Build System tests: -include(QtBaseCMakeTesting) + ## QtBase specific configure tests: + include(QtBaseConfigureTests) -## Targets for global features, etc.: -include(QtBaseGlobalTargets) + ## Build System tests: + include(QtBaseCMakeTesting) -qt_set_language_standards() + ## Targets for global features, etc.: + include(QtBaseGlobalTargets) -## Decide whether tools will be built. -qt_check_if_tools_will_be_built() + ## Set language standards after QtBaseGlobalTargets, because that's when the relevant + ## feature variables are available. + qt_set_language_standards() -## Visit all the directories: -add_subdirectory(src) + ## Visit all the directories: + add_subdirectory(src) +endif() -if (BUILD_TESTING) +if(BUILD_TESTING) add_subdirectory(tests) endif() -if (QT_WILL_BUILD_TOOLS) - add_subdirectory(qmake) +if(NOT QT_BUILD_STANDALONE_TESTS) + if(QT_WILL_BUILD_TOOLS) + add_subdirectory(qmake) + endif() + # As long as we use the mkspecs (for qplatformdefs.h), we need to always + # install it, especially when cross-compiling. + set(mkspecs_install_dir "${INSTALL_DATADIR}") + qt_path_join(mkspecs_install_dir ${QT_INSTALL_DIR} ${mkspecs_install_dir}) + + qt_copy_or_install(DIRECTORY "${PROJECT_SOURCE_DIR}/mkspecs" + DESTINATION ${mkspecs_install_dir}) endif() -# As long as we use the mkspecs (for qplatformdefs.h), we need to always -# install it, especially when cross-compiling. -set(mkspecs_install_dir "${INSTALL_DATADIR}") -qt_path_join(mkspecs_install_dir ${QT_INSTALL_DIR} ${mkspecs_install_dir}) - -qt_copy_or_install(DIRECTORY "${PROJECT_SOURCE_DIR}/mkspecs" - DESTINATION ${mkspecs_install_dir}) - - qt_build_repo_end() -if(BUILD_EXAMPLES) +if(NOT QT_BUILD_STANDALONE_TESTS AND BUILD_EXAMPLES) add_subdirectory(examples) endif() diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake index a1e66ffcbe..7864d40501 100644 --- a/cmake/QtAutoDetect.cmake +++ b/cmake/QtAutoDetect.cmake @@ -2,9 +2,12 @@ # Collection of auto dection routines to improve the user eperience when # building Qt from source. # +# Make sure to not run detection when building standalone tests, because the detection was already +# done when initially configuring qtbase. function(qt_auto_detect_android) - if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID) + if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID + AND NOT QT_BUILD_STANDALONE_TESTS) file(READ ${CMAKE_TOOLCHAIN_FILE} toolchain_file_content OFFSET 0 LIMIT 80) string(FIND ${toolchain_file_content} "The Android Open Source Project" find_result REVERSE) @@ -31,7 +34,7 @@ function(qt_auto_detect_android) endfunction() function(qt_auto_detect_vpckg) - if(DEFINED ENV{VCPKG_ROOT}) + if(DEFINED ENV{VCPKG_ROOT} AND NOT QT_BUILD_STANDALONE_TESTS) set(vcpkg_toolchain_file "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") get_filename_component(vcpkg_toolchain_file "${vcpkg_toolchain_file}" ABSOLUTE) @@ -49,6 +52,10 @@ function(qt_auto_detect_vpckg) message(STATUS "Using vcpkg triplet ${VCPKG_TARGET_TRIPLET}") endif() unset(vcpkg_toolchain_file) + message(STATUS "CMAKE_TOOLCHAIN_FILE is: ${CMAKE_TOOLCHAIN_FILE}") + if(DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + message(STATUS "VCPKG_CHAINLOAD_TOOLCHAIN_FILE is: ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") + endif() endif() endfunction() diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index cb2070f773..1ff33dc706 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -60,37 +60,42 @@ macro(qt_build_repo_begin) # Find Apple frameworks if needed. qt_find_apple_system_frameworks() + + # Decide whether tools will be built. + qt_check_if_tools_will_be_built() endmacro() macro(qt_build_repo_end) - # Delayed actions on some of the Qt targets: - include(QtPostProcess) - - # Install the repo-specific cmake find modules. - qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE}) - - if(NOT PROJECT_NAME STREQUAL "QtBase") - if (EXISTS cmake) - qt_copy_or_install(DIRECTORY cmake/ - DESTINATION "${__qt_repo_install_dir}" - FILES_MATCHING PATTERN "Find*.cmake" - ) + if(NOT QT_BUILD_STANDALONE_TESTS) + # Delayed actions on some of the Qt targets: + include(QtPostProcess) + + # Install the repo-specific cmake find modules. + qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE}) + + if(NOT PROJECT_NAME STREQUAL "QtBase") + if (EXISTS cmake) + qt_copy_or_install(DIRECTORY cmake/ + DESTINATION "${__qt_repo_install_dir}" + FILES_MATCHING PATTERN "Find*.cmake" + ) + endif() endif() - endif() - # Print a feature summary: - feature_summary(WHAT PACKAGES_FOUND - REQUIRED_PACKAGES_NOT_FOUND - RECOMMENDED_PACKAGES_NOT_FOUND - OPTIONAL_PACKAGES_NOT_FOUND - RUNTIME_PACKAGES_NOT_FOUND - FATAL_ON_MISSING_REQUIRED_PACKAGES) + # Print a feature summary: + feature_summary(WHAT PACKAGES_FOUND + REQUIRED_PACKAGES_NOT_FOUND + RECOMMENDED_PACKAGES_NOT_FOUND + OPTIONAL_PACKAGES_NOT_FOUND + RUNTIME_PACKAGES_NOT_FOUND + FATAL_ON_MISSING_REQUIRED_PACKAGES) + endif() qt_print_build_instructions() endmacro() function(qt_print_build_instructions) - if(NOT PROJECT_NAME STREQUAL "QtBase") + if(NOT PROJECT_NAME STREQUAL "QtBase" OR QT_BUILD_STANDALONE_TESTS) return() endif() @@ -118,19 +123,18 @@ macro(qt_build_repo) # If testing is enabled, try to find the qtbase Test package. # Do this before adding src, because there might be test related conditions # in source. - if (BUILD_TESTING) + if (BUILD_TESTING AND NOT QT_BUILD_STANDALONE_TESTS) find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test) endif() - ## Decide whether tools will be built. - qt_check_if_tools_will_be_built() - - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt") - add_subdirectory(src) - endif() + if(NOT QT_BUILD_STANDALONE_TESTS) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt") + add_subdirectory(src) + endif() - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt") - add_subdirectory(tools) + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt") + add_subdirectory(tools) + endif() endif() if (BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt") @@ -139,23 +143,34 @@ macro(qt_build_repo) qt_build_repo_end() - if (BUILD_EXAMPLES AND BUILD_SHARED_LIBS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt") + if (BUILD_EXAMPLES AND BUILD_SHARED_LIBS + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt" + AND NOT QT_BUILD_STANDALONE_TESTS) add_subdirectory(examples) endif() endmacro() macro(qt_set_up_standalone_tests_build) - qt_set_up_build_internals_paths() - include(QtSetup) - - # Optionally include a repo specific Setup module. - include(QtRepoSetup OPTIONAL) - - qt_find_apple_system_frameworks() - qt_check_if_tools_will_be_built() + # Remove this macro once all usages of it have been removed. + # Standalone tests are not handled via the main repo project and qt_build_tests. endmacro() macro(qt_build_tests) + if(QT_BUILD_STANDALONE_TESTS) + # Find location of TestsConfig.cmake. These contain the modules that need to be + # find_package'd when testing. + set(_qt_build_tests_install_prefix + "${QT_CONFIG_INSTALL_DIR}/${INSTALL_CMAKE_NAMESPACE}BuildInternals/StandaloneTests") + if(QT_WILL_INSTALL) + qt_path_join(_qt_build_tests_install_prefix + ${CMAKE_INSTALL_PREFIX} ${_qt_build_tests_install_prefix}) + endif() + include("${_qt_build_tests_install_prefix}/${CMAKE_PROJECT_NAME}TestsConfig.cmake") + + # Of course we always need the test module as well. + find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Test) + endif() + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/auto/CMakeLists.txt") add_subdirectory(auto) endif() diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index ffa367cb9e..f77cfe546e 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -346,10 +346,37 @@ function(qt_create_tools_config_files) endforeach() endfunction() +function(qt_internal_create_config_file_for_standalone_tests) + set(standalone_tests_config_dir "StandaloneTests") + qt_path_join(config_build_dir + ${QT_CONFIG_BUILD_DIR} + "${INSTALL_CMAKE_NAMESPACE}BuildInternals" "${standalone_tests_config_dir}") + qt_path_join(config_install_dir + ${QT_CONFIG_INSTALL_DIR} + "${INSTALL_CMAKE_NAMESPACE}BuildInternals" "${standalone_tests_config_dir}") + + list(JOIN QT_REPO_KNOWN_MODULES " " QT_REPO_KNOWN_MODULES_STRING) + string(STRIP "${QT_REPO_KNOWN_MODULES_STRING}" QT_REPO_KNOWN_MODULES_STRING) + + # Ceate a Config file that calls find_package on the modules that were built as part + # of the current repo. This is used for standalone tests. + configure_file( + "${QT_CMAKE_DIR}/QtStandaloneTestsConfig.cmake.in" + "${config_build_dir}/${CMAKE_PROJECT_NAME}TestsConfig.cmake" + @ONLY + ) + qt_install(FILES + "${config_build_dir}/${CMAKE_PROJECT_NAME}TestsConfig.cmake" + DESTINATION "${config_install_dir}" + COMPONENT Devel + ) +endfunction() + qt_create_tools_config_files() qt_internal_create_depends_files() qt_generate_build_internals_extra_cmake_code() qt_internal_create_plugins_files() +qt_internal_create_config_file_for_standalone_tests() if (ANDROID) qt_modules_process_android_dependencies() diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 837b81db4d..04b26d9596 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -39,7 +39,7 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # or when enabling developer builds and no prefix is specified. # This detection only happens when building qtbase, and later is propagated via the generated # QtBuildInternalsExtra.cmake file. -if (PROJECT_NAME STREQUAL "QtBase") +if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS) if((CMAKE_INSTALL_PREFIX STREQUAL CMAKE_BINARY_DIR) OR (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build)) @@ -87,6 +87,14 @@ endif() ## Set up testing option(BUILD_TESTING "Build the testing tree." ${QT_BUILD_TESTING}) +if(QT_BUILD_STANDALONE_TESTS) + set(QT_BUILD_TESTING ON) + + # BuildInternals might have set it to OFF on initial configuration. So force it to ON when + # building standalone tests. + set(BUILD_TESTING ON CACHE BOOL "Build the testing tree." FORCE) +endif() + include(CTest) enable_testing() diff --git a/cmake/QtStandaloneTestsConfig.cmake.in b/cmake/QtStandaloneTestsConfig.cmake.in new file mode 100644 index 0000000000..3d08ae0c12 --- /dev/null +++ b/cmake/QtStandaloneTestsConfig.cmake.in @@ -0,0 +1,2 @@ +find_package(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@ + REQUIRED COMPONENTS @QT_REPO_KNOWN_MODULES_STRING@) diff --git a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml index 81b0f7773b..59a2f09f0d 100644 --- a/coin/instructions/cmake_build_and_upload_test_artifacts.yaml +++ b/coin/instructions/cmake_build_and_upload_test_artifacts.yaml @@ -1,21 +1,16 @@ type: Group instructions: - type: ChangeDirectory - directory: "{{.SourceDir}}/tests" - - type: EnvironmentVariable - variableName: COIN_CMAKE_ARGS - variableValue: "{{.SourceDir}}\\tests" - enable_if: - condition: property - property: host.os - equals_value: Windows + directory: "{{.SourceDir}}" + - type: MakeDirectory + directory: "standalone_tests" + - type: SetBuildDirectory + directory: "{{.SourceDir}}/standalone_tests" + - type: ChangeDirectory + directory: "{{.BuildDir}}" - type: EnvironmentVariable variableName: COIN_CMAKE_ARGS - variableValue: "{{.SourceDir}}/tests" - disable_if: - condition: property - property: host.os - equals_value: Windows + variableValue: "-DQT_BUILD_STANDALONE_TESTS=ON -S {{.SourceDir}} -B ." - !include "{{qt/qtbase}}/call_cmake.yaml" - type: ExecuteCommand command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel" @@ -25,7 +20,7 @@ instructions: Failed to build sources. In the current state bug can be everywhere. Contact Liang first. - type: UploadTestArtifact transferType: UploadModuleTestsArtifact - archiveDirectory: "{{.SourceDir}}/tests" + archiveDirectory: "{{.BuildDir}}" maxTimeInSeconds: 1200 maxTimeBetweenOutput: 1200 disable_if: diff --git a/coin/instructions/cmake_regular_test_instructions.yaml b/coin/instructions/cmake_regular_test_instructions.yaml index 10a8d6fbff..6974b293dd 100644 --- a/coin/instructions/cmake_regular_test_instructions.yaml +++ b/coin/instructions/cmake_regular_test_instructions.yaml @@ -1,14 +1,18 @@ type: Group instructions: + - type: ChangeDirectory + directory: "{{.SourceDir}}" + - type: MakeDirectory + directory: "standalone_tests" - type: InstallTestBinaryArchive relativeStoragePath: "{{.Env.MODULE_ARTIFACTS_RELATIVE_STORAGE_PATH}}/tests.tar.gz" - directory: "{{.SourceDir}}/tests" + directory: "{{.SourceDir}}/standalone_tests" maxTimeInSeconds: 1200 maxTimeBetweenOutput: 1200 userMessageOnFailure: > Failed to install tests archive. - type: ChangeDirectory - directory: "{{.SourceDir}}/tests" + directory: "{{.SourceDir}}/standalone_tests" - type: ExecuteCommand command: "ctest -V --rerun-failed" ignoreExitCode: true diff --git a/tests/.prev_CMakeLists.txt b/tests/.prev_CMakeLists.txt new file mode 100644 index 0000000000..221413713e --- /dev/null +++ b/tests/.prev_CMakeLists.txt @@ -0,0 +1,7 @@ +# Generated from tests.pro. + +if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. +endif() +qt_build_tests() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ae0aa141f4..d1a395c9f3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,21 +1,13 @@ -# special case begin -if(NOT TARGET Qt::Test) - cmake_minimum_required(VERSION 3.14.0) - project(QtBaseTests VERSION 6.0.0 LANGUAGES C CXX ASM) - find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core Test) - find_package(Qt6 COMPONENTS DBus Gui OpenGL Widgets Xml - AccessibilitySupport LinuxAccessibilitySupport - WindowsUIAutomationSupport - ) - qt_set_up_standalone_tests_build() +# Generated from tests.pro. - # Find a few packages that are usually found in configure.cmake, - # because a few tests link directly against those libraries. +if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. + # special case begin qt_find_package(WrapDBus1 PROVIDED_TARGETS dbus-1) qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data) qt_find_package(Threads PROVIDED_TARGETS Threads::Threads) qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::OpenSSL) + # special case end endif() -# special case end - qt_build_tests() diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index b8588203bd..ea5f2b91e1 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3248,12 +3248,9 @@ def handle_top_level_repo_tests_project(scope: Scope, cm_fh: IO[str]): content = dedent( f"""\ - if(NOT TARGET Qt::Test) - cmake_minimum_required(VERSION {cmake_version_string}) - project({qt_lib} VERSION 6.0.0 LANGUAGES C CXX) - find_package(Qt6 ${{PROJECT_VERSION}} REQUIRED COMPONENTS BuildInternals Core SET_ME_TO_SOMETHING_USEFUL) - find_package(Qt6 ${{PROJECT_VERSION}} OPTIONAL_COMPONENTS SET_ME_TO_SOMETHING_USEFUL){requires_content} - qt_set_up_standalone_tests_build() + if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. endif() qt_build_tests() """ |