Use Qt5::* notation with target_link_libraries, & PUBLIC/PRIVATE interfaces Remove the few explicit Qt5 include dirs, not needed
ClosedPublic

Authored by kossebau on Apr 18 2016, 1:56 AM.

Details

Summary

Qt5::* notation is the usual way to refer to the imported cmake targets
representing the Qt5 modules/libs. The ${Qt5*_LIBRARIES} might be from
the transitional mode, right?

PUBLIC & PRIVATE link interfaces help to speed up compilation & linking,
because libs listed in PRIVATE will stay implementation detail of the lib
and not result in consumers of the lib also having those libs in the link
list. And it also reduces the amount of includes used, so less dirs to
search headers in.

Separate commit also removes the few explicit Qt5 include dirs, which are not needed:
The include dirs are automatically added, derived from the
imported targets for the Qt5 libs that are listed in
the TARGET_LINK_LIBRARIES command.

Another separate commit makes libastro completely Qt-independent:
so far the export header was relying on QtGlobal to reuse the Q_DECL_EXPORT/Q_DECL_IMPORT defines
cmake has a macro generate_export_header which can be used instead.
(triggered by removal of broad global include statements for Qt headers in toplevel CMakeLists.txt)

Test Plan

Build normal marble for desktop. Also build Android apk of Marble Maps and ran it successfully on my Jolla.

Diff Detail

Repository
R34 Marble
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau updated this revision to Diff 3392.Apr 18 2016, 1:56 AM
kossebau retitled this revision from to Use Qt5::* notation with target_link_libraries, & PUBLIC/PRIVATE interfaces Remove the few explicit Qt5 include dirs, not needed.
kossebau updated this object.
kossebau edited the test plan for this revision. (Show Details)
kossebau added reviewers: rahn, nienhueser.

I assume if this patch is okay it should be also backported to App/16.04.
Would then also pick up all the cleanup commits I just pushed before directly to master. Those seemed not worth a review, hopefully you agree.

kossebau planned changes to this revision.Apr 18 2016, 5:11 PM

Found this needs some fixes for the Android build. Build already works locally again, but still need to see if creating apks works, will only test tonight.

kossebau updated this revision to Diff 3404.Apr 19 2016, 12:09 AM

Fixed Android builds & made libastro completely Qt-less

Updating D1438: Use Qt5::* notation with target_link_libraries, & PUBLIC/PRIVATE interfaces

Created an APK of MarbleMaps which then ran on my Jolla :) So should be
quite okay now.

This patchset now completely relies on the modern Qt5 & cmake way
to derive things from targets listed in

As a sideeffect of the cleanup libabstro no longer saw Qt includes,
so its export header now longer could lean on Qt's macros. cmake has macro
for such export headers, which I propose to use instead (used not only all over KDE
now).

kossebau updated this object.Apr 19 2016, 12:27 AM
kossebau edited the test plan for this revision. (Show Details)
nienhueser accepted this revision.Apr 24 2016, 2:25 PM
nienhueser edited edge metadata.

Lovely, thanks. The old style was from transitional mode when we supported older cmake versions indeed.

I'm fine with pushing it as is and then resolve the Mac/Windows todos once we run into them (e.g. for Windows next time I do a release there).

This revision is now accepted and ready to land.Apr 24 2016, 2:25 PM
This revision was automatically updated to reflect the committed changes.