diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-12 15:51:17 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-08-15 10:56:02 +0000 |
commit | b8dae2c617af4cceb886b5ae87ab3dbe79a4ecd0 (patch) | |
tree | 7baa75e33a28c652555109279e5afba3d3d98f84 /util | |
parent | 7fda42ef9ad1d4980c905ff4415124adf5d06966 (diff) |
Handle test helpers better
Teach pro2cmake to use add_qt_test_helper instead of
add_qt_executable when the qmake 'qt_test_helper' feature is used.
Don't use macOS bundles when building tests on macOS, because that
breaks path assumptions for certain tests.
Introduce a new OVERRIDE_OUTPUT_DIRECTORY option for add_qt_test_helper
that allows placing the binary into a folder other than the test parent
folder. I considered changing the default behavior not to place into the
parent folder, but that would break all existing tests, so I opted for
override approach instead. Ultimately we might want to revisit this
later.
Change-Id: I68fd1dea608333c2af0d3896050b40a6964dd87f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/pro2cmake.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 29fd885370..f6d354f19c 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -2008,7 +2008,14 @@ def write_binary(cm_fh: typing.IO[str], scope: Scope, binary_name = scope.TARGET assert binary_name - extra = ['GUI',] if gui else [] + is_qt_test_helper = 'qt_test_helper' in scope.get('_LOADED') + + extra = ['GUI'] if gui and not is_qt_test_helper else [] + cmake_function_call = 'add_qt_executable' + + if is_qt_test_helper: + binary_name += '_helper' + cmake_function_call = 'add_qt_test_helper' target_path = scope.get_string('target.path') if target_path: @@ -2017,7 +2024,7 @@ def write_binary(cm_fh: typing.IO[str], scope: Scope, if 'target' in scope.get('INSTALLS'): extra.append('INSTALL_DIRECTORY "{}"'.format(target_path)) - write_main_part(cm_fh, binary_name, 'Binary', 'add_qt_executable', scope, + write_main_part(cm_fh, binary_name, 'Binary', cmake_function_call, scope, extra_lines=extra, indent=indent, known_libraries={'Qt::Core', }, extra_keys=['target.path', 'INSTALLS']) |