pro2cmake: Support QML IMPORTPATH with multiple elements

Change-Id: I8113d7dd4e7967d020d59a5b4104e8366d55283c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Jüri Valdmann 2019-09-17 11:27:47 +02:00
parent ce8337dbeb
commit 933d383a24
2 changed files with 8 additions and 8 deletions

View File

@ -2247,7 +2247,7 @@ endfunction()
function(add_qt_test name)
qt_parse_all_arguments(arg "add_qt_test"
"RUN_SERIAL;EXCEPTIONS;GUI;QMLTEST"
"QML_IMPORTPATH;OUTPUT_DIRECTORY" "TESTDATA;${__default_private_args};${__default_public_args}" ${ARGN})
"OUTPUT_DIRECTORY" "QML_IMPORTPATH;TESTDATA;${__default_private_args};${__default_public_args}" ${ARGN})
if (NOT arg_OUTPUT_DIRECTORY)
set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
@ -2313,9 +2313,9 @@ function(add_qt_test name)
)
endif()
if (arg_QML_IMPORTPATH)
set(extra_test_args "-import" "${arg_QML_IMPORTPATH}")
endif()
foreach(path IN LISTS arg_QML_IMPORTPATH)
list(APPEND extra_test_args "-import" "${path}")
endforeach()
# Generate a label in the form tests/auto/foo/bar/tst_baz
# and use it also for XML output

View File

@ -2125,11 +2125,11 @@ def write_test(cm_fh: typing.IO[str], scope: Scope,
if 'qmltestcase' in scope.get('CONFIG'):
libraries.add('Qt::QmlTest')
extra.append('QMLTEST')
importpath = scope.get('IMPORTPATH')
importpath = scope.expand('IMPORTPATH')
if importpath:
qml_importpath = scope.expandString(importpath)
if qml_importpath:
extra.append('QML_IMPORTPATH "{}"'.format(qml_importpath))
extra.append('QML_IMPORTPATH')
for path in importpath:
extra.append(' "{}"'.format(path))
write_main_part(cm_fh, test_name, 'Test', 'add_qt_test', scope,
indent=indent, known_libraries=libraries,