[KPhotoAlbum] CMakeLists.txt and libkface
Tobias Leupold
tobias.leupold at web.de
Fri Nov 14 15:26:50 GMT 2014
Hi list!
I recently had a small conversation with the Gentoo guys maintaining the KPA
ebuilds about how to handle optional dependencies like libkface. Currently,
this is the way we search for it (added by Pino Toscano):
find_package(Kface 3.5.0 CONFIG)
set(KFACE_FOUND ${Kface_FOUND})
if(KFACE_FOUND)
set(KFACE_LIBRARIES ${Kface_LIBRARIES})
INCLUDE_DIRECTORIES(${Kface_INCLUDE_DIR})
else()
unset(KFACE_FOUND)
pkg_check_modules(KFACE libkface>=3.5.0)
if(KFACE_FOUND)
INCLUDE_DIRECTORIES(${KFACE_INCLUDE_DIR})
endif()
endif(KFACE_FOUND)
macro_bool_to_01(KFACE_FOUND HAVE_KFACE)
This includes a "fallback" search if no cmake module for libkface is found.
But it also (apparently, I'm not a cmake pro ;-) makes it hard to skip the
libkface inclusion if the library is present, but should not be used to build
KPA.
Michael Palimaka from Gentoo said that if it's possible, we should use
find_package. It's true that older versions of libkface do not ship a cmake
module. But we need at least libkface 3.5.0 (currently only available from git
master), which comes with a cmake module. So if we have some libkface version
installed without it, it's too old anyway, so I think we don't need this
fallback check.
So I tried it with:
find_package(Kface 3.5.0 CONFIG)
macro_bool_to_01(KFACE_FOUND HAVE_KFACE)
if(KFACE_FOUND)
INCLUDE_DIRECTORIES(${KFACE_INCLUDE_DIR})
endif(KFACE_FOUND)
which works just fine here, with and without libkface, and will also play nice
with Portage and USE flags on Gentoo. Would you please verify that this is
also okay on other systems?
Thanks in advance!
Cheers, Tobias
More information about the Kphotoalbum
mailing list