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>
This commit is contained in:
parent
0761715f79
commit
ee5d7facc1
@ -1369,6 +1369,10 @@ class Scope(object):
|
||||
target = self.expandString("TARGET") or os.path.splitext(os.path.basename(self.file))[0]
|
||||
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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user