[CMake] 3rd party cmake files

Alexander Neundorf a.neundorf-work at gmx.net
Wed Jun 7 16:50:37 EDT 2006


Hi,

> Von: Brad King <brad.king at kitware.com>
> 
> Alexander Neundorf wrote:
> > Ok, we need a solution here.
> > Now that cmake is going to enter the "center stage" :-) things are going
> to change in this regard.
> > Until now cmake comes with FindFoo.cmake modules for all other software 
> packages. 
> > Once other software packages will also use cmake as their native 
> buildsystem it will be better if these projects deliver the required cmake
> files themselves, be it FindFoo.cmake or FooConfig.cmake files.
> > In KDE we have now already two "independent" software packages:
> > kdewin32 and qtdbus, which both use cmake as their native build system, 
> which are both independent from KDE and which both have to be installed 
> before starting to compile KDE (i.e. kdelibs).
> > Now in kdelibs we need a way to find kdewin32 and qtdbus.
> > For kdewin32 this wouldn't be a big problem. For qtdbus there are more 
> issues. It features some cmake macros for code generation 
> (QTDBUS_ADD_INTERFACES()). These are used when building qtdbus itself and 
> also when compiling software which uses qtdbus. So qtdbus should install 
> the cmake files which contain these macros.
> > Requiring every user to manually adjust KDEWIN32_Dir and QTDBUS_Dir is 
> not really an option for the long term.
> 
> What's wrong with using FIND_PATH to locate FooConfig.cmake as I 
> suggested previously?  Then kdelibs would have a FindFoo.cmake that 
> contains no knowledge of Foo except that it provides a FooConfig.cmake. 
>   Project Foo would install FooConfig.cmake to contain all the 
> information about where Foo is located.  The CMake code in kdelibs would 
> have
> 
> FIND_PACKAGE(Foo)
> 
> which uses the kdelibs copy of the simple FindFoo.cmake.  If it is not 
> found automatically for some reason then the user would set Foo_DIR to 
> the location of one file (rather than Foo_INCLUDE_DIR and Foo_LIBRARY 
> separately).
> 
> In this solution FindFoo.cmake contains only a few lines like
> 
> find_path(QtDBUS_DIR FindQtDBUS.cmake PATHS ...)
> if(EXISTS ${QtDBUS_DIR}/QtDBUSConfig.cmake)
>    include(${QtDBUS_DIR}/QtDBUSConfig.cmake)
> else(EXISTS ${QtDBUS_DIR}/QtDBUSConfig.cmake)
>    # ...report not found...
> endif(EXISTS ${QtDBUS_DIR}/QtDBUSConfig.cmake)
> 
> which does not depend on the Foo version and thus does not have to come 
> with Foo.  Since the find_path command can list PATH_SUFFIXES and other 
> places to look, kdelibs should be able to find Foo automatically.

Ok, will try that.
Still I have a slightly bad feeling with the FooConfig.cmake approach, since this hardcodes the locations, whereas a normal FindFoo.cmake feels more flexible.
Where should I install the file to, something like CMAKE_INSTALL_PREFIX/share/qtdbus/cmake/ ?

Bye
Alex

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail


More information about the CMake mailing list