qtbase
qtbase copied to clipboard
BUG: Only create library if target does not exist
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
andQt5Svg_QSvgIconPlugin.cmake
- QSvgPlugin:
Qt5Gui_QSvgPlugin.cmake
andQt5Svg_QSvgPlugin.cmake
Note: Qt 5.14 was retrieved as the official commercial build, not built from source.
cc: @KyleFromKitware, @alcroito
+1
@agirault This is only a mirror - see https://wiki.qt.io/Qt_Contribution_Guidelines for instructions on how to contribute.