summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-01-14 13:30:12 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-14 13:16:45 +0000
commitee5d7facc14a4d91475ac5e95dba5f346ee3f880 (patch)
treef6a3233715adf27107694b292015a6b534e08712 /util
parent0761715f791a3b8d529521e2c0ac7ba462d55e03 (diff)
Adjust OUTPUT_DIRECTORY for tests when targets starts with ../
Automatically insert OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../ for each tests that has a target name which starts with ../. To do so we added the TARGET_ORIGINAL property which does not remove the ../ from the target name. Change-Id: I55ba1385aa160610a0ff80ed56ff37a80c3590fa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 8378cd6228..97f92d7614 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -1370,6 +1370,10 @@ class Scope(object):
return re.sub(r"\.\./", "", target)
@property
+ def TARGET_ORIGINAL(self) -> str:
+ return self.expandString("TARGET") or os.path.splitext(os.path.basename(self.file))[0]
+
+ @property
def _INCLUDED(self) -> List[str]:
return self.get("_INCLUDED")
@@ -2904,6 +2908,10 @@ def write_test(cm_fh: IO[str], scope: Scope, gui: bool = False, *, indent: int =
for path in importpath:
extra.append(f' "{path}"')
+ target_original = scope.TARGET_ORIGINAL
+ if target_original and target_original.startswith("../"):
+ extra.append("OUTPUT_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/../\"")
+
requires_content = expand_project_requirements(scope, skip_message=True)
if requires_content:
requires_content += "\n"