summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtSetup.cmake6
-rw-r--r--cmake/QtTestHelpers.cmake25
-rw-r--r--src/corelib/Qt6CoreMacros.cmake20
3 files changed, 45 insertions, 6 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 7c5cfe90c9..dd656ef70c 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -241,10 +241,10 @@ endif()
option(QT_BUILD_TESTS_BATCHED "Link all tests into a single binary." ${_qt_batch_tests})
-if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.18")
+if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.19")
message(FATAL_ERROR
- "Test batching requires at least CMake 3.18, due to requiring per-source "
- "TARGET_DIRECTORY assignments.")
+ "Test batching requires at least CMake 3.19, due to requiring per-source "
+ "TARGET_DIRECTORY assignments and DEFER calls.")
endif()
# QT_BUILD_TOOLS_WHEN_CROSSCOMPILING -> QT_FORCE_BUILD_TOOLS
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 4facf13c03..2dee5076cb 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -672,10 +672,29 @@ function(qt_internal_add_test name)
foreach(testdata IN LISTS arg_TESTDATA)
list(APPEND builtin_files ${testdata})
endforeach()
+ foreach(file IN LISTS builtin_files)
+ set_source_files_properties(${file}
+ PROPERTIES QT_SKIP_QUICKCOMPILER TRUE
+ )
+ endforeach()
- set(blacklist_path "BLACKLIST")
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
- list(APPEND builtin_files ${blacklist_path})
+ if(setting_up_batched_test)
+ set(blacklist_path "BLACKLIST")
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
+ get_target_property(blacklist_files ${name} _qt_blacklist_files)
+ if(NOT blacklist_files)
+ set_target_properties(${name} PROPERTIES _qt_blacklist_files "")
+ set(blacklist_files "")
+ cmake_language(EVAL CODE "cmake_language(DEFER DIRECTORY \"${CMAKE_SOURCE_DIR}\" CALL \"_qt_internal_finalize_batch\" \"${name}\") ")
+ endif()
+ list(PREPEND blacklist_files "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
+ set_target_properties(${name} PROPERTIES _qt_blacklist_files "${blacklist_files}")
+ endif()
+ else()
+ set(blacklist_path "BLACKLIST")
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
+ list(APPEND builtin_files ${blacklist_path})
+ endif()
endif()
list(REMOVE_DUPLICATES builtin_files)
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 556704d2fe..5cdbdf3716 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -670,6 +670,26 @@ function(_qt_internal_finalize_executable target)
set_target_properties(${target} PROPERTIES _qt_executable_is_finalized TRUE)
endfunction()
+function(_cat IN_FILE OUT_FILE)
+ file(READ ${IN_FILE} CONTENTS)
+ file(APPEND ${OUT_FILE} "${CONTENTS}\n")
+endfunction()
+
+function(_qt_internal_finalize_batch name)
+ find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core)
+
+ set(generated_blacklist_file "${CMAKE_CURRENT_BINARY_DIR}/BLACKLIST")
+ get_target_property(blacklist_files "${name}" _qt_blacklist_files)
+ file(WRITE "${generated_blacklist_file}" "")
+ foreach(blacklist_file ${blacklist_files})
+ _cat("${blacklist_file}" "${generated_blacklist_file}")
+ endforeach()
+ qt_internal_add_resource(${name} "batch_blacklist"
+ PREFIX "/"
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/BLACKLIST"
+ BASE ${CMAKE_CURRENT_BINARY_DIR})
+endfunction()
+
# If a task needs to run before any targets are finalized in the current directory
# scope, call this function and pass the ID of that task as the argument.
function(_qt_internal_delay_finalization_until_after defer_id)