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?
_________________________________________________________
Mike Jackson                  mike.jack...@bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Sat, Mar 20, 2010 at 8:16 AM, Daniel Lidström <daniel.lidst...@sbg.se> wrote:
> Hello,
>
> I am just starting to get familiar with CMake. We are currently using 
> Boost.Build,
> so I am of course used to the behaviour of Boost.Build. One of the things I 
> am now
> trying to do with CMake is to set library usage requirements. For example, 
> with
> Boost.Build I can specify the include/ directory as a usage requirement of a 
> library.
> So when I then have this library as a dependency of another library I don't 
> have to
> specify the include directory. With CMake I am seeing myself writing 
> include_directories
> in a lot of places. Here's my attempt (parts copied from my CMakeLists):
>
> project(UMC3D)
>
> # here's a library of my own that I want to use
> # in order to use this library from another library
> # you must add the directory GFL/include to your include_directories
> add_library(GFL SHARED
>  ${DataIO_src}
> )
>
> # so here's a library which uses GFL
> add_library(Device SHARED
>  ${Device_src}
> )
> include_directories(
>  ${UMC3D_SOURCE_DIR}/GFL
> )
> target_link_libraries(Device
>  GFL
> )
>
> # and here's an executable that also uses GFL
> add_executable(GFL.Test
>  ${Test_src}
> )
> include_directories(
>  ${UMC3D_SOURCE_DIR}/GFL
> )
> target_link_libraries(GFL.Test
>  GFL
> )
>
>
> The way I see it is that this is not scalable. If I need to change GFL, for 
> example
> move the headers to another directory, I would then need to update both 
> Device and GFL.Test.
> This is not necessary with out-of-the-box Boost.Build where GFL can specify 
> usage requirements.
> Is there a similar solution with CMake? Hopefully I am being clear, please 
> let me know otherwise.
> Any help is much appreciated!
>
> Thanks in advance.
>
> Regards,
>
> Daniel Lidström
> Stockholm, Sweden
> _______________________________________________
> 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
>
_______________________________________________
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