diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-21 16:22:36 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-09-22 10:27:22 +0000 |
commit | f35cc5090a3d78ee7f843625d2c19e472e031cc7 (patch) | |
tree | cea37a7e3d5e930e7b5aa70d27c2264ac43d723d /util | |
parent | 900df4812278f8c9cde915690a2be355307f09dd (diff) |
configurejson2cmake: handle out-of-line config tests
Generate appropriate qt_config_compile_test() calls for config tests
that have CMake projects. These are protected by an if(EXISTS) check
so that configuration doesn't fail for repos where the config tests
have not been ported yet.
Adjust the qt_config_compile_test() function to use try_compile for
projects specified via new PROJECT_PATH argument.
Change-Id: I83c061e384f68688a654b782fd7a9bede282d1e3
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/configurejson2cmake.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 2c3d98ddfb..51d89d56ab 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -516,7 +516,16 @@ def parseTest(ctx, test, data, cm_fh): details = data["test"] if isinstance(details, str): - print(f" XXXX UNHANDLED TEST SUB-TYPE {details} in test description") + if not ctx['test_dir']: + print(f" XXXX UNHANDLED TEST SUB-TYPE {details} in test description") + return + + cm_fh.write(f""" +if(EXISTS "${{CMAKE_CURRENT_SOURCE_DIR}}/{ctx['test_dir']}/{data['test']}/CMakeLists.txt") + qt_config_compile_test("{data['test']}" + PROJECT_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/{ctx['test_dir']}/{data['test']}") +endif() +""") return head = details.get("head", "") @@ -975,6 +984,7 @@ def processSubconfigs(dir, ctx, data): def processJson(dir, ctx, data): ctx["module"] = data.get("module", "global") + ctx["test_dir"] = data.get("testDir", "") ctx = processFiles(ctx, data) |