On Tuesday 17 January 2012, Lance Luvaul wrote:
> I think cmake's find_package is only a first order approximation to
> premake's usages.  What usage library targets have that find_package
> doesn't is the ability to cleanly inject dependency info (like include
> dirs or link libraries) into any target that claims to be dependent on
> the library.  This is achieved simply by having the target call "uses
> <library>"... there is no need for the target to explicitly add anything
> to target_link_libraries() or include_directories().

For the linking part this works with cmake.
That's what you have to do with cmake:

find_package(Foo REQUIRED)

include_directories(${FOO_INCLUDES})
add_executable(HelloWorld ${srcs})
target_link_libraries(HelloWorld ${FOO_LIBRARIES} )

Dependencies are handled properly by the target_link_libraries() call, i.e. 
transitive libraries are added.

If FindFoo.cmake or FooConfig.cmake create imported targets for the libraries 
in question, these imported targets have properties.
Currently these properties contain the actual location of the library on disk, 
also for different configurations, so on Windows you'll get the debug library 
in a debug build, and the release library in a release build.

It is planned to add support for having the include directories also as such a 
target propery, so that you could save the include_directories() call in the 
example above.

Alex
--

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