[cmake-developers] RFC: Helper macros for writing Find modules

Alex Merry alex.merry at kde.org
Fri Mar 13 06:04:28 EDT 2015


For the extra-cmake-modules package, I wrote some macros to help with writing 
component-based Find modules, which are non-trivial to get right.

The documentation for them can be found here: 
http://api.kde.org/ecm/module/ECMFindModuleHelpers.html

I've found them incredibly useful in writing classic Find modules, where you 
just want to find a bunch of libraries and their associated headers, but you 
also need to account for the dependencies between those libraries.

The interface is a little unusual: you have to set up some information-
providing variables before calling the macros to describe the information for 
each component. As an example, see http://quickgit.kde.org/?p=extra-cmake-modules.git&a=blob&h=c5a56c1635d03acdaf5ccd780b9a358d6f6655fd&hb=4f81d1a92e4ccc2ce7b33d2860397a526b1a4d2f&f=find-modules%2FFindWayland.cmake (which I would also submit for inclusion to CMake 
if this is accepted).

Would this be something that might be included in CMake?

I have some ideas about how to extend it to be able to account for debug vs 
release libraries as well (roughly following a simplified version of the 
pattern of the FindQt4 module).

Alex


More information about the cmake-developers mailing list