[CMake] FIND_PACKAGE from another Project

Alexander Neundorf a.neundorf-work at gmx.net
Tue Jun 10 16:28:23 EDT 2008


On Tuesday 10 June 2008, hsanson wrote:
> Alexander Neundorf wrote:
...
> > Which project do you want to use ?
> > Probably you will want to write a FindFoo.cmake file for it, which will
> > contain mostly FIND_LIBRARY() and FIND_PATH() calls.
>
> Thanks,  I already have Find<name>.cmake files for all my projects
> (libraries I am implementing) and I can use them. The problem is that by
> using Find<name>.cmake files I am forced to compile and install each
> project (i.e. library) individually and in order so dependencies are
> satisfied. I want to create a single CMakeLists.txt file that would
> compile and install all the projects making sure dependencies are
> satisfied.  So far the <name>Config.cmake file seems the way to do this

I don't think so, they serve basically the same purpose as the FindFoo.cmake 
files.

> but if there is another better way please let me know.

Then all these projects would have to be built as one project. if you are 
careful you can write the cmake files so that they work both as separate 
projects as well as as within one "umbrella-project".
A basic rule for that would be to avoid CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR 
and use <Project>_SOURCE_DIR and <PROJECT>_BINARY_DIR.

Not sure this is what you want to do...

Alex


More information about the CMake mailing list