Make qt_internal_test_batch_target_name publicly available

The batch test target name is a useful thing to obtain in various
target-generating scripts.

Change-Id: I9605cf860fe1485e48108eba7e93f9064209d8fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mikolaj Boc 2022-08-24 09:28:37 +02:00
parent e8031906b5
commit b134300bc4
4 changed files with 10 additions and 10 deletions

View File

@ -102,3 +102,7 @@ if(NOT result EQUAL 0)
endif()"
)
endfunction()
function(_qt_internal_test_batch_target_name out)
set(${out} "test_batch" PARENT_SCOPE)
endfunction()

View File

@ -7,7 +7,7 @@ function(qt_internal_add_resource target resourceName)
if(NOT in_batch)
message(FATAL_ERROR "Trying to add resource to a non-existing target \"${target}\".")
endif()
qt_internal_test_batch_target_name(target)
_qt_internal_test_batch_target_name(target)
endif()
# Don't try to add resources when cross compiling, and the target is actually a host target

View File

@ -9,7 +9,7 @@ function(qt_internal_extend_target target)
if(NOT in_batch)
message(FATAL_ERROR "Trying to extend a non-existing target \"${target}\".")
endif()
qt_internal_test_batch_target_name(target)
_qt_internal_test_batch_target_name(target)
endif()
# Don't try to extend_target when cross compiling an imported host target (like a tool).
@ -893,7 +893,7 @@ function(qt_internal_undefine_global_definition target)
if(NOT ${in_batch})
message(FATAL_ERROR "${target} is not a target.")
endif()
qt_internal_test_batch_target_name(target)
_qt_internal_test_batch_target_name(target)
endif()
if("${ARGN}" STREQUAL "")

View File

@ -77,15 +77,11 @@ endfunction()
function(qt_internal_add_test_dependencies target)
if(QT_BUILD_TESTS_BATCHED)
qt_internal_test_batch_target_name(target)
_qt_internal_test_batch_target_name(target)
endif()
add_dependencies(${target} ${ARGN})
endfunction()
function(qt_internal_test_batch_target_name out)
set(${out} "test_batch" PARENT_SCOPE)
endfunction()
# Simple wrapper around qt_internal_add_executable for manual tests which insure that
# the binary is built under ${CMAKE_CURRENT_BINARY_DIR} and never installed.
# See qt_internal_add_executable() for more details.
@ -267,7 +263,7 @@ function(qt_internal_add_test_to_batch batch_name name)
arg "${optional_args}" "${single_value_args}" "${multi_value_args}" ${ARGN})
qt_internal_prepare_test_target_flags(version_arg exceptions_text gui_text ${ARGN})
qt_internal_test_batch_target_name(target)
_qt_internal_test_batch_target_name(target)
# Lazy-init the test batch
if(NOT TARGET ${target})
@ -705,7 +701,7 @@ for this function. Will be ignored")
set(executable_name ${arg_NAME})
if(QT_BUILD_TESTS_BATCHED)
qt_internal_test_batch_target_name(executable_name)
_qt_internal_test_batch_target_name(executable_name)
endif()
add_test(NAME "${arg_NAME}" COMMAND "${CMAKE_COMMAND}" "-P" "${arg_OUTPUT_FILE}"
WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}")