From 1057d568bb921e378b9fc5eb6c95b39dd6dc94fa Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 2 Mar 2020 10:58:34 +0100 Subject: 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 Reviewed-by: Alexandru Croitor --- util/cmake/configurejson2cmake.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'util/cmake') 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) -- cgit v1.2.3