Add option to specify working directory for qt_add_test

Change-Id: Iba5104cccdc613f7b2cf0d1454209578adaac824
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Leander Beernaert 2019-12-10 14:21:36 +01:00
parent e0205f1793
commit 6c20ae774c

View File

@ -2574,7 +2574,9 @@ endfunction()
function(qt_add_test name) function(qt_add_test name)
qt_parse_all_arguments(arg "qt_add_test" qt_parse_all_arguments(arg "qt_add_test"
"RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST" "RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST"
"OUTPUT_DIRECTORY" "QML_IMPORTPATH;TESTDATA;${__default_private_args};${__default_public_args}" ${ARGN}) "OUTPUT_DIRECTORY;WORKING_DIRECTORY"
"QML_IMPORTPATH;TESTDATA;${__default_private_args};${__default_public_args}" ${ARGN}
)
if (NOT arg_OUTPUT_DIRECTORY) if (NOT arg_OUTPUT_DIRECTORY)
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
@ -2658,7 +2660,11 @@ function(qt_add_test name)
set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}") set(test_working_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(test_executable ${QT_CMAKE_EXPORT_NAMESPACE}::qmltestrunner) set(test_executable ${QT_CMAKE_EXPORT_NAMESPACE}::qmltestrunner)
else() else()
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}") if (arg_WORKING_DIRECTORY)
set(test_working_dir "${arg_WORKING_DIRECTORY}")
else()
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}")
endif()
set(test_executable "${name}") set(test_executable "${name}")
endif() endif()