From 3549f51c98fd6430ee09ceca78edd5b6e66660e1 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Fri, 9 Aug 2019 15:20:19 +0200 Subject: [PATCH] Fix cases where DESTDIR equals ./ or ../ When DESTDIR has relative paths as a parameter we should prefix those with ${CMAKE_CURRENT_BINARY_DIR} in order for them to be placed in the correct location. Change-Id: Ie9e9d656cbb54457bdf99425e3e1b05e09f20d7c Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor --- util/cmake/pro2cmake.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index efc57e26e92..0b81cb10e18 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1865,6 +1865,8 @@ def write_main_part(cm_fh: typing.IO[str], name: str, typename: str, # Check for DESTDIR override destdir = scope.get_string('DESTDIR') if destdir: + if destdir.startswith('./') or destdir.startswith('../'): + destdir = '${CMAKE_CURRENT_BINARY_DIR}/' + destdir extra_lines.append('OUTPUT_DIRECTORY "{}"'.format(destdir)) cm_fh.write('{}{}({}\n'.format(spaces(indent), cmake_function, name))