summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-05-29 09:57:34 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-05-29 08:58:52 +0000
commitd908e0a47db862a43fbb11fe3f2beae01a42244b (patch)
tree66af6b7236fd93a6b8c99ac6af7f9b9e29531ff2 /util
parent9864ff22aab9915e7f63c5d19e66b0e149432455 (diff)
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 <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-xutil/cmake/pro2cmake.py13
1 files changed, 11 insertions, 2 deletions
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)