[CMake] Fwd: Installing Find<name>.cmake files

Alexander Neundorf a.neundorf-work at gmx.net
Sat Jun 14 12:50:12 EDT 2008


On Friday 13 June 2008, Horacio Sanson wrote:
>  I have created some shared libraries I use in some of my
> applications. The CMake of these libraries generate the respective
> Find<name>.cmake files that other applications use to locate the
> header and binary files they need to link it.
>
> At this time I simply create a directory in my home folder and access
> the Find<name>.cmake files from there but was wondering if it is good
> practice to install these files in the /usr/share/cmake/Modules
> directory so I do not have to include my home folder in each other

No, not really.
I also thought this would be a good idea for quite some time.
But it is not.
Actually you need FindFoo.cmake both when Foo is already installed but also 
when Foo is not installed, then it must tell you that Foo is not installed.
This means it doesn't make sense if a FindFoo.cmake is installed by Foo 
itself.

With CMake >= 2.6.0 package Foo can install a file FooConfig.cmake e.g. 
to /usr/lib/foo/FooConfig.cmake (see docs for find_package()), this file can 
then contain detailled information about the installed package Foo.

Are you using/requiring cmake 2.4 or 2.6 ?

Do you distribute these libs ?

If you don't distribute them and you use it only on your system then I'd say 
it is ok if you install them wherever you want, if you distribute the 
software I would strongly recommend not to install them 
to /usr/share/cmake/Modules/

In KDE we install a whole bunch of Find<XXX>.cmake files with kdelibs, but 
these modules are not for kdelibs itself, but for other packages.

Alex


More information about the CMake mailing list