Don't create convenience plugin target when not needed

If the OUTPUT_NAME of a plugin is the same as the CMake target name,
don't try to create a custom target with the same name. That will
cause configuration errors due to duplicate targets.

Amends f67d8ae2d4339c50cf0a4ca26f25c3afebc128ea

Change-Id: Iaea7c68e22dbc1e345ba10950c312618abba4c21
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-01-27 15:03:08 +01:00
parent a3ff42ade6
commit fd590b9482

View File

@ -2215,7 +2215,7 @@ function(qt_add_plugin target)
set_property(TARGET "${target}" PROPERTY OUTPUT_NAME "${output_name}")
# Add a custom target with the Qt5 qmake name for a more user friendly ninja experience.
if(arg_OUTPUT_NAME)
if(arg_OUTPUT_NAME AND NOT TARGET "${output_name}")
add_custom_target("${output_name}")
add_dependencies("${output_name}" "${target}")
endif()