A macro for bundled 3rdparty sources

Yury G. Kudryashov urkud.urkud at gmail.com
Fri Feb 24 18:06:56 UTC 2012


Hi!

Some project have snapshots of 3rdparty dependencies in their source trees. 
E.g., digikam tarball contains a lot of external dependencies.

Currently FindKexiv2.cmake (and some other Find modules) do very odd thing:
* First, they try to find libkexiv2 in one of hardcoded subdirs of 
$CMAKE_SOURCE_DIR. The subdirs are hardcoded into FindKexiv2.cmake.
* If failed, they use pkg-config (!) to locate libkexiv2.

I propose the following solution.
* Libkexiv2 writes ${CMAKE_CURRENT_BINARY_DIR}/LibKexiv2InternalConfig.cmake 
that points cmake to the build tree.
* Libkexiv2 installs another LibKexiv2Config.cmake that points cmake to the 
install tree.
* digikam (or any other project) has something like this:
find_package(LibKexiv2 "2.0.0" NO_MODULE)
if(NOT LIBKEXIV2_FOUND)
  add_subdirectory(path/to/libkexiv2)
  find_package(LibKexiv2 "2.0.0" NO_MODULE PATHS 
${CMAKE_CURRENT_BINARY_DIR}/path/to/libkexiv2 NAMES LibKexiv2Internal 
NO_DEFAULT_PATH)
endif()

The latter part can be wrapped into a macro that will add options (say, 
PREFER_SYSTEM_PACKAGE_LIBKEXIV2 which defaults to 
${PREFER_SYSTEM_PACKAGES}).

What do you think about this? I'd like to get some feedback here before 
talking to digikam developers.
-- 
Yury G. Kudryashov,
mailto: urkud at mccme.ru



More information about the Kde-buildsystem mailing list