qtbase icon indicating copy to clipboard operation
qtbase copied to clipboard

BUG: Only create library if target does not exist

Open agirault opened this issue 5 years ago • 3 comments

With CMake 3.15 and Qt 5.14, the following command:

find_package(Qt5 5.14 CONFIG REQUIRED COMPONENTS Gui)

results in these errors:

CMake Error at /.../qt5/lib/cmake/Qt5Gui/Qt5Gui_QSvgPlugin.cmake:3 (add_library):
  add_library cannot create imported target "Qt5::QSvgPlugin" because another
  target with the same name already exists.
Call Stack (most recent call first):
  /.../qt5/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:337 (include)
  /.../qt5/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)

and

CMake Error at /.../qt5/lib/cmake/Qt5Svg/Qt5Svg_QSvgIconPlugin.cmake:2 (add_library):
  add_library cannot create imported target "Qt5::QSvgIconPlugin" because
  another target with the same name already exists.
Call Stack (most recent call first):
  /.../qt5/lib/cmake/Qt5Svg/Qt5SvgConfig.cmake:337 (include)
  /.../qt5/lib/cmake/Qt5Gui/Qt5Gui_QSvgIconPlugin.cmake:8 (find_package)
  /.../qt5/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:337 (include)
  /.../qt5/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)

because the following targets are defined in two files:

  • QSvgIconPlugin: Qt5Gui_QSvgIconPlugin.cmake and Qt5Svg_QSvgIconPlugin.cmake
  • QSvgPlugin: Qt5Gui_QSvgPlugin.cmake and Qt5Svg_QSvgPlugin.cmake

Note: Qt 5.14 was retrieved as the official commercial build, not built from source.

agirault avatar Jan 20 '20 22:01 agirault

cc: @KyleFromKitware, @alcroito

agirault avatar Jan 20 '20 22:01 agirault

+1

KyleFromKitware avatar Jan 21 '20 13:01 KyleFromKitware

@agirault This is only a mirror - see https://wiki.qt.io/Qt_Contribution_Guidelines for instructions on how to contribute.

KyleFromKitware avatar Jan 21 '20 16:01 KyleFromKitware