[CMake] Where to put own FindXXX.cmake files?

Brad King brad.king at kitware.com
Fri Apr 3 14:37:20 EDT 2009


Dominique Belhachemi wrote:
> i would like to add a FindXXX.cmake to each of my library packages.
> 
> Let's compare CMake with pkgconfig. A package containing a library is
> responsible to put a .pc file into /usr/lib/pkgconfig/
[snip]
> A package knows best where to find its own include and library
> files. To maintain a FindXXX.cmake file should not be the task of CMake.

There is no point in providing a FindXXX.cmake file with your package
because the project finding XXX would need to locate FindXXX.cmake first.
A FindXXX.cmake module is used for packages that do not provide cmake
packaging files, and has to come with the client project or with CMake.

If your package is CMake-aware then it should install a CMake package file:

   http://www.cmake.org/Wiki/CMake_2.6_Notes#Packages

This file is found by the find_package command with no help from a
FindXXX.cmake file at all.

> Where can I put my custom FindXXX.cmake files ? Is it OK to write in 
> /usr/share/cmake-2.6/Modules/ ??

No.  That is for CMake's installation.

-Brad



More information about the CMake mailing list