On 20. Mar, 2010, at 14:15 , Daniel Lidström wrote:

> Hi Mike, 
> 
>> Most of us would write a "FindGFL.cmake" file which will locate the
>> GFL library and set GFL_INCLUDE_DIRS, GFL_LIBRARIES, and other
>> standard directories/files like that. Some of these files will do the
>> "include(${GFL_INCLUDE_DIRS}" for you and some will not.
>>   Some design those (like FindQt4.cmake) with an additional
>> "UseQt4.cmake" which you simply do an "include(${USE_QT4_FILE})". So
>> in your case, if you have a large project with lots of project
>> dependent on a few of your libraries I would write a "FindGFL.cmake"
>> that does the "include()" for you. Then your cmake files look
>> something like this.
>> 
>> 
>> set (CMAKE_MODULE_PATH "Path/To/Your/Find*.cmake/Dir" 
>> ${CMAKE_MODULE_PATH} )
>> Find_package(GFL)
>> 
>> add_library(somelib ${srcs})
>> target_link_libraries (somelib ${GFL_LIBRARIES} )
>> 
>> This is much more scalable. Does that help?
> 
> This would definitely help me. I am wondering one thing though. Do you
> place all your FindXXX.cmake in the same folder? If I understand you
> correctly it would like something like this:
> 
> UMC3D/
> CMakeLists.txt
> GFL/
>  CMakeLists.txt
> Device/
>  CMakeLists.txt
> Test/
>  CMakeLists.txt
> 
> Then I need to create a CMake folder like so:
> 
> UMC3D/
> CMake/
>  FindGFL.cmake
>  FindDevice.cmake
>  .
>  .
>  .
> 
> A difference that I can see with this compared to Boost.Build is that the
> configuration of GFL (build and usage) is separated (GFL/CMakeLists.txt + 
> CMake/FindGFL.cmake).
> Is this how you deal with this? Maybe it is not a big problem.
> 
> Regards,
> 
> Daniel Lidström
> Stockholm, Sweden 

If the projects UMC3D, GFL etc can be used independently, but are all "under 
your control", then you shouldn't write FindUMC3D.cmake, FindGFL.cmake etc 
files, but create UMC3D-config.cmake, GFL-config.cmake etc files instead. Read 
the documentation of the FIND_PACKAGE command, especially the paragraphs about 
the "config mode". You'll also find many discussions on this in the archives of 
this list.


Michael

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to