From d908e0a47db862a43fbb11fe3f2beae01a42244b Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Wed, 29 May 2019 09:57:34 +0200 Subject: Fix uncessary relative dir suffix in pro2cmake.py When we replace the PWD key from qmake files and both the base and current directory are the same, there's no need to add an extra './' to the current working directory. This also fixes a unit test in qtsvg as it requires the passed in path to match exactly to the one outputed in the log files. Change-Id: Ide9ca6a70493e8039d3af84a9e576d8f6a313f2a Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann --- util/cmake/pro2cmake.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 2f4c74b821..89bc844261 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -591,10 +591,19 @@ class Scope(object): return result def get(self, key: str, *, ignore_includes: bool = False, inherrit: bool = False) -> typing.List[str]: + + is_same_path = self.currentdir == self.basedir + if key == 'PWD': - return ['${CMAKE_CURRENT_SOURCE_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] + if is_same_path: + return ['${CMAKE_CURRENT_SOURCE_DIR}'] + else: + return ['${CMAKE_CURRENT_SOURCE_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] if key == 'OUT_PWD': - return ['${CMAKE_CURRENT_BUILD_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] + if is_same_path: + return ['${CMAKE_CURRENT_BUILD_DIR}'] + else: + return ['${CMAKE_CURRENT_BUILD_DIR}/' + os.path.relpath(self.currentdir, self.basedir),] return self._evalOps(key, None, [], inherrit=inherrit) -- cgit v1.2.3