Why do we use find_package(Qt5Widgets) ?

Stephen Kelly steveire at gmail.com
Thu Jul 18 20:34:36 UTC 2013


Alexander Neundorf wrote:

> On Thursday 18 July 2013, Stephen Kelly wrote:
>> Alexander Neundorf wrote:
>> > find_package(Qt5 COMPONENTS Core Widgets) ?
>> 
>> Is your question "I expect this to break but it doesn't. Why?"?
> 
> No. Should I expect it to break ?

No.

> On one side, it's a style question. 

Ok. That was not clear.

> Multiple Qt modules can be searched
> this way with one call.
> Additionally, shouldn't libraries which are used directly also be linked
> directly ? People using the gold linker had more problems with such things
> than when using the GNU linker. I don't know in detail how this is handled
> now with all the new features of imported targets in cmake.

This has worked with cmake for a long time. Only LINK_INTERFACE_LIBRARIES 
with imported targets were needed to make that work.

> Are there downsides when using the umbrella Qt5 config file compared to
> using the separate ones ?

There is no point in specifying Core as you did above. These are equivalent:

 find_package(Qt5Widgets REQUIRED)
 find_package(Qt5 REQUIRED Widgets)

Thanks,

Steve.




More information about the Kde-frameworks-devel mailing list