summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-03-02 10:58:34 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-03-05 07:48:20 +0100
commit1057d568bb921e378b9fc5eb6c95b39dd6dc94fa (patch)
treef5aaa64b7525d52dbb2b869ea28cb2b118814153
parent343865201aa3543790c40017ce02340171a8c2ba (diff)
configurejson2cmake: Fix non-inline compile tests
If there's no test dir set, use "config.tests" as default value, and perform the check for the existence of CMakeLists.txt in configurejson2cmake, not the configure.cmake file. Change-Id: I8d3be8f2b68767c7592665c374022353c2dc6c57 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rwxr-xr-xutil/cmake/configurejson2cmake.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py
index b85d551a70..6eea6e0be8 100755
--- a/util/cmake/configurejson2cmake.py
+++ b/util/cmake/configurejson2cmake.py
@@ -533,19 +533,15 @@ def parseTest(ctx, test, data, cm_fh):
details = test
if isinstance(details, str):
- 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']}"
- LABEL "{data['label']}"
- PROJECT_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/{ctx['test_dir']}/{data['test']}")
-endif()
+ rel_test_project_path = f"{ctx['test_dir']}/{details}"
+ if posixpath.exists(f"{ctx['project_dir']}/{rel_test_project_path}/CMakeLists.txt"):
+ cm_fh.write(
+ f"""
+qt_config_compile_test("{details}"
+ LABEL "{data['label']}"
+ PROJECT_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/{rel_test_project_path}")
"""
- )
+ )
return
head = details.get("head", "")
@@ -1077,8 +1073,9 @@ def processSubconfigs(path, ctx, data):
def processJson(path, ctx, data):
+ ctx["project_dir"] = path
ctx["module"] = data.get("module", "global")
- ctx["test_dir"] = data.get("testDir", "")
+ ctx["test_dir"] = data.get("testDir", "config.tests")
ctx = processFiles(ctx, data)