Do not set OUTPUT_DIRECTORY if it is already set
This can happen in unit tests where a test has TARGET set to "../name", which requires the target to placed in the parent binary directory. It is possible to run into a second assignment for OUTPUT_DIRECTORY via the DESTDIR property (e.g: qdbushmarshall test) which can then result in two OUTPUT_DIRECTORY values. However, the first one needs to take precedence or the tests won't execute properly. Change-Id: Ib263843fa86c3dd68d92a0989b95f2890335c92d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
7c6f763d85
commit
99a824bbb7
@ -2710,8 +2710,14 @@ def write_main_part(
|
||||
# Check for DESTDIR override
|
||||
destdir = scope.get_string("DESTDIR")
|
||||
if destdir:
|
||||
destdir = replace_path_constants(destdir, scope)
|
||||
extra_lines.append(f'OUTPUT_DIRECTORY "{destdir}"')
|
||||
already_added = False
|
||||
for line in extra_lines:
|
||||
if line.startswith("OUTPUT_DIRECTORY"):
|
||||
already_added = True
|
||||
break
|
||||
if not already_added:
|
||||
destdir = replace_path_constants(destdir, scope)
|
||||
extra_lines.append(f'OUTPUT_DIRECTORY "{destdir}"')
|
||||
|
||||
cm_fh.write(f"{spaces(indent)}{cmake_function}({name}\n")
|
||||
for extra_line in extra_lines:
|
||||
|
Loading…
Reference in New Issue
Block a user