make cmake/FindLibIcal.cmake ready for cross compilation.
AbandonedPublic

Authored by knauss on Jan 21 2018, 6:46 PM.

Details

Reviewers
winterz
Group Reviewers
KDE PIM
Summary

As mentioned in a Debian Bug [887827] kcalcore can't be built
with cross compilation. On Linux we can simply use PkgConfig.

[887827] https://bugs.debian.org/887827

Test Plan

build kcalcore

Diff Detail

Repository
R172 KCalendar Core
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
knauss created this revision.Jan 21 2018, 6:46 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 21 2018, 6:46 PM
knauss requested review of this revision.Jan 21 2018, 6:46 PM
knauss retitled this revision from make cmake/FindLibIcal.cmake ready for croos compilation. to make cmake/FindLibIcal.cmake ready for cross compilation..Jan 21 2018, 6:47 PM

maybe we can also use pkgConfig on Windows and mac and make this file a lot more elegant and short?

krop added a subscriber: krop.Jan 22 2018, 8:42 AM
krop added inline comments.
cmake/FindLibIcal.cmake
4

Please change it back to LibIcal_INCLUDE_DIRS. We're following the CMake policies and coding style recommendations

Xxx_INCLUDE_DIRS

The final set of include directories listed in one variable for use by client code. This should not be a cache entry.
19

if/endif are not needed for pkgconfig calls

krop added inline comments.Jan 22 2018, 8:55 AM
cmake/FindLibIcal.cmake
20–22

use the QUIET keyword for both lines

157

endif()

@cgiboudeaux: did you checked on Windows? Is the whole WIN32 block is still needed, or can it removed completly?

cmake/FindLibIcal.cmake
4

mmh i changed it because pkgconfig returns XXX_INCLUDEDIR and I thought so this is the more "stadardized" name.

20–22

for the first I can understand, beause we don't want PkgConfig found line shown.
But why QUIT for the second line?

91

if we don't if/endif the pkgconfig call, we can modify to
if(NOT LibIcal_FOUND)

krop added a comment.Jan 23 2018, 10:43 AM

@cgiboudeaux: did you checked on Windows? Is the whole WIN32 block is still needed, or can it removed completly?

https://community.kde.org/Policies/CMake_Coding_Style#.28Not.29_Using_pkg-config

putting something like if(NOT WIN32) around the pkg-config stuff is not necessary (and should be removed if it is somewhere). If pkg-config is not found, e.g. on Windows, the macros simply do nothing.

krop added inline comments.Jan 23 2018, 10:50 AM
cmake/FindLibIcal.cmake
4

and it's not :) What should be removed however is ${LibIcal_INCLUDE_DIRS}/libical at the bottom of this file.
This should be part of LibIcal_INCLUDE_DIRS if necessary.

20–22

Because we don't need the pkg-config output.
Our policy is that The Find_xxx.cmake modules should only use the pkg-config output as HINTS. The stuff must be found even if the .pc file cannot be found (eg: on Windows).

knauss updated this revision to Diff 25819.Jan 23 2018, 1:57 PM
knauss marked 6 inline comments as done.

Fix issues raised by cgiboudeaux.

krop added inline comments.Jan 23 2018, 3:05 PM
cmake/FindLibIcal.cmake
19

still missing the QUIET keyword.
Please also rename LibIcal to avoid confusion between the pkgconfig vars and the CMake ones (pick eg 'PC_LibIcal' )

21

Not needed here, it doesn't exist yet

22

it's not the right place for that. See below

23

Remove

37

+ ${PC_LibIcal_INCLUDEDIR}

That's where we use the pkgconfig result

43–44

+ ${PC_LibIcal_LIBDIR}

50–51

+ ${PC_LibIcal_LIBDIR}