summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2019-03-28 15:08:00 +0100
committerTobias Hunger <tobias.hunger@qt.io>2019-03-29 14:06:41 +0000
commit828f2965e78a2178266ec3b54f922ccea324693d (patch)
tree2cfd87c5ad034a03d23edc00531fb5071232c415 /util
parentfeeae8e27ff01987078f894fe2f5e7144d935394 (diff)
CMake: pro2cmake.py: deduplicate and sort libraries
Change-Id: I924cfac365a0b4ba18c2579820bc37729f1ea8d9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Diffstat (limited to 'util')
-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 bdc277fa0a..66edf5bd19 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -910,8 +910,9 @@ def write_sources_section(cm_fh: typing.IO[str], scope: Scope, *,
dependencies += scope.expand('QMAKE_USE_PRIVATE') + scope.expand('QMAKE_USE') \
+ scope.expand('LIBS_PRIVATE') + scope.expand('LIBS')
if dependencies:
- cm_fh.write('{} LIBRARIES\n'.format(ind))
+ dependencies_to_print = []
is_framework = False
+
for d in dependencies:
if d == '-framework':
is_framework = True
@@ -925,9 +926,14 @@ def write_sources_section(cm_fh: typing.IO[str], scope: Scope, *,
d = '# Remove: {}'.format(d[1:])
else:
d = substitute_libs(d)
- cm_fh.write('{} {}\n'.format(ind, d))
+ dependencies_to_print.append(d)
is_framework = False
+ if dependencies_to_print:
+ cm_fh.write('{} LIBRARIES\n'.format(ind))
+ for d in sorted(list(set(dependencies_to_print))):
+ cm_fh.write('{} {}\n'.format(ind, d))
+
compile_options = scope.get('QMAKE_CXXFLAGS')
if compile_options:
cm_fh.write('{} COMPILE_OPTIONS\n'.format(ind))