CMake: Fix find_package(Qt6*Tools) in non-qtbase tests
Tests in non-qtbase modules could not find_package their own Qt6*Tools packages, because add_subdirectory(tests) was called before the config files for Qt6*Tools were created. The creation of tools config files is done in QtPostProcess.cmake, which was included in qt_build_repo_end(). Move that include into its own macro, qt_build_repo_post_process() and remove it from qt_build_repo_end(). Call qt_build_repo_post_process() before the 'tests' directory is added in qt_build_repo(). Every call site of qt_build_repo_end() must now be adjusted and call qt_build_repo_post_process(). Task-number: QTBUG-88264 Change-Id: I80d60a1b5c0e9b715c298ef4934b562f815432d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
f081578ce0
commit
b684984939
@ -177,13 +177,6 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
add_subdirectory(src)
|
||||
endif()
|
||||
|
||||
if(QT_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
|
||||
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
if(QT_WILL_BUILD_TOOLS AND QT_FEATURE_settings)
|
||||
add_subdirectory(qmake)
|
||||
@ -208,6 +201,15 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
qt_build_repo_post_process()
|
||||
|
||||
if(QT_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
|
||||
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
qt_build_repo_end()
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)
|
||||
|
@ -408,6 +408,7 @@ macro(qt_internal_prepare_single_repo_target_set_build)
|
||||
endmacro()
|
||||
|
||||
macro(qt_build_repo_begin)
|
||||
set(QT_INTERNAL_REPO_POST_PROCESS_CALLED FALSE)
|
||||
list(APPEND CMAKE_MESSAGE_CONTEXT "${PROJECT_NAME}")
|
||||
|
||||
qt_build_internals_set_up_private_api()
|
||||
@ -543,10 +544,21 @@ macro(qt_build_repo_begin)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Runs delayed actions on some of the Qt targets.
|
||||
# Can be called either explicitly or as part of qt_build_repo_end().
|
||||
macro(qt_build_repo_post_process)
|
||||
if(QT_INTERNAL_REPO_POST_PROCESS_CALLED)
|
||||
return()
|
||||
endif()
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
include(QtPostProcess)
|
||||
endif()
|
||||
set(QT_INTERNAL_REPO_POST_PROCESS_CALLED TRUE)
|
||||
endmacro()
|
||||
|
||||
macro(qt_build_repo_end)
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS)
|
||||
# Delayed actions on some of the Qt targets:
|
||||
include(QtPostProcess)
|
||||
qt_build_repo_post_process()
|
||||
|
||||
# Install the repo-specific cmake find modules.
|
||||
qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE})
|
||||
@ -601,6 +613,8 @@ macro(qt_build_repo)
|
||||
qt_build_repo_impl_find_package_tests()
|
||||
qt_build_repo_impl_src()
|
||||
qt_build_repo_impl_tools()
|
||||
|
||||
qt_build_repo_post_process()
|
||||
qt_build_repo_impl_tests()
|
||||
|
||||
qt_build_repo_end()
|
||||
|
@ -29,4 +29,5 @@ add_subdirectory(mock4plugin)
|
||||
add_subdirectory(mock5plugin)
|
||||
add_subdirectory(mock6plugin)
|
||||
|
||||
qt_build_repo_post_process()
|
||||
qt_build_repo_end()
|
||||
|
@ -20,4 +20,5 @@ qt_build_repo_begin()
|
||||
add_subdirectory(test_autogenerating_cpp_exports)
|
||||
add_subdirectory(test_autogenerating_cpp_exports_custom_name)
|
||||
|
||||
qt_build_repo_post_process()
|
||||
qt_build_repo_end()
|
||||
|
@ -22,4 +22,5 @@ add_subdirectory(mock_static_resources1)
|
||||
add_subdirectory(test_init_resources_static_plugin)
|
||||
add_subdirectory(test_static_resources_propagation)
|
||||
|
||||
qt_build_repo_post_process()
|
||||
qt_build_repo_end()
|
||||
|
Loading…
Reference in New Issue
Block a user