[CMake] How to set cmake-module-path

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jul 2 10:16:55 EDT 2007


On Friday 29 June 2007 16:37, Andreas Pakulat wrote:
> Hi,
>
> I have two separate projects here, one builds an executable and provides
> a FindFoo.cmake file which is installed into <prefix>/share/cmake/modules/
>
> The second project wants to use that FindFoo.cmake and I'm currently
> struggling with allowing the two to be installed into different
> directories. I can provide a cmake variable in the 2nd project and then
> use that as base for determining the cmake-modules path, however that
> breaks when one of the CMakeLists.txt is changed and the user runs just
> make in the builddir. Then cmake complains about the FindFoo.cmake not
> "findable".
>
> Whats the good solution (apart from providing a foo-config
> executable) for this problem?

Not sure.
In theory the FindFoo.cmake would have to come either with cmake or with the 
project which wants to use Foo.

CMake doesn't support additional modules directories except those set using 
the cmake variable CMAKE_MODULE_PATH (which has to be set in the cmake files 
so so the cmake script has to know before where it wants to look).

For KDE4 it works that way that a small FindKDE4.cmake comes with cmake which 
knows where to look for KDE4 and will then include the big cmake files which 
comes with KDE4.

(I guess this doesn't help a lot)

Alex


More information about the CMake mailing list