CMake: pro2cmake.py: deduplicate and sort libraries

Change-Id: I924cfac365a0b4ba18c2579820bc37729f1ea8d9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
This commit is contained in:
Tobias Hunger 2019-03-28 15:08:00 +01:00
parent feeae8e27f
commit 828f2965e7

View File

@ -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))