[CMake] How to set cmake-module-path

Andreas Pakulat apaku at gmx.de
Mon Jul 2 10:42:13 EDT 2007


On 02.07.07 10:16:55, Alexander Neundorf wrote:
> 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.

Thats a bad option for a library, every project replicating the
FindFoo...

> 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).

Yeah, thats what I do currently in the projects, but its really not
pretty. And people get confused because the cmake errors they get don't
tell them what to do...

> (I guess this doesn't help a lot)

Well, it helped a bit, as it clarifies that there is no "right" and
non-ugly way to do this. So I'll see that I improve the logic I have or
provide a foo-config executable to provide the right
data-dir.

Andreas

-- 
You teach best what you most need to learn.


More information about the CMake mailing list