cmake: moc - remove duplicate includes/defines

the generated `-D` and `-I` flags contain quite a number of duplicate
entries. since cmake-3.15 it is easy to strip them via a generator
expression

Change-Id: I83915c9074e0e2e62e79cd932cad2fa07e8a12aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tim Blechmann 2022-04-27 22:45:20 +08:00
parent cdd4a95317
commit 948e1f9d82

View File

@ -130,8 +130,8 @@ function(_qt_internal_create_moc_command infile outfile moc_flags moc_options
set(targetincludes "$<TARGET_PROPERTY:${moc_target},INCLUDE_DIRECTORIES>")
set(targetdefines "$<TARGET_PROPERTY:${moc_target},COMPILE_DEFINITIONS>")
set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:${targetincludes},\n-I>\n>")
set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:${targetdefines},\n-D>\n>")
set(targetincludes "$<$<BOOL:${targetincludes}>:-I$<JOIN:$<REMOVE_DUPLICATES:${targetincludes}>,\n-I>\n>")
set(targetdefines "$<$<BOOL:${targetdefines}>:-D$<JOIN:$<REMOVE_DUPLICATES:${targetdefines}>,\n-D>\n>")
file (GENERATE
OUTPUT ${_moc_parameters_file}