summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-01-16 09:29:29 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-16 08:36:43 +0000
commit99a824bbb74aa88a16a8c7b483e1ca599dd66d4f (patch)
treeb168bea43a19929c5bce4b9bcae24e322bcb5ec2 /util/cmake/pro2cmake.py
parent7c6f763d85c16bb1f3ee1ec8d845696188bef067 (diff)
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>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index 97f92d7614..ffb36324cd 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -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: