Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.4.1
-
None
-
Linux
Description
Using the qt6_add_executable() cmake statement implicitly calls target_link_libraries(). The documentation even says so.
Unfortunately this is utterly unhelpful because most apps won't just want the one library added that the Qt cmake script adds. And cmake doesn't allow calling the target_link_libraries multiple times without generating an error.
CMake Error at CMakeLists.txt:188 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "pay". All uses of target_link_libraries with a target must be
either all-keyword or all-plain.
The uses of the keyword signature are here:
- /usr/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:549 (target_link_libraries)
—
The Qt docs work around this by suggesting to add some libraries PRIVATE. But that doesn't work if you add a bunch of libraries which already have their own target_link_libraries set out of your control.
Please remove the useless and harmful "helping" call to target_link_libraries in the Qt6CoreMacros.cmake file.