[CMake] find_package and INTERFACE targets in 3.0

Nils Gladitz nilsgladitz at gmail.com
Fri Jul 18 08:23:30 EDT 2014


On 07/18/2014 05:00 AM, Walter Gray wrote:
> Hi list!
>
> I'm a big fan of the new INTERFACE targets & target usage requirements,
> but none of the provided Find<package>.cmake files seem to take
> advantage of the new paradigm.  Checking the wiki, the old
> Find<package>.cmake seem to be deprecated, with most of the information
> on authoring new packages assuming that you are the developer of the
> module, not the consumer. What is the recommended way to deal with
> packages that don't provide these config files? I'll happily write my
> own Find<package>.cmake files, however that approach seems deprecated
> and I haven't found any good examples of find modules that define IMPORT
> or INTERFACE targets instead of the older method of setting a bunch of
> <package>_xxx variables.

There are a few modules that use imported targets in 3.0 and a few more 
were updated in master.

I see e.g. FindGLUT, FindQt4, FindGTK2, FindZLIB, FindOpenGL and 
FindGLEW making use of imported targets in master[1].

[2] documents how to write find modules and includes an example with 
IMPORTED targets.

Nils

[1] 
http://cmake.org/gitweb?p=cmake.git;a=tree;f=Modules;h=5d17682cb231f119b677ce67d804852d3be6d46f;hb=HEAD

[2] 
http://www.cmake.org/cmake/help/git-master/manual/cmake-developer.7.html#find-modules


More information about the CMake mailing list