[CMake] 3rd party cmake files

Brad King brad.king at kitware.com
Wed Jun 7 17:06:57 EDT 2006


Alexander Neundorf wrote:
>>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.

There is no reason FooConfig.cmake has to hard code paths.  It is 
generated by the author of project Foo.  It can use paths relative to 
Foo_DIR.

 > Where should I install the file to, something like 
CMAKE_INSTALL_PREFIX/share/qtdbus/cmake/ ?

That looks fine to me.  The small FindQtDBUS file has to know where to 
look for it though.

-Brad


More information about the CMake mailing list