Hi,

I haven't followed the long thread between Brad and Stephen about importing 
and exporting targets closely...

So, if I understand correctly, in the future the following cmake code

find_package(Foo)

add_executable(hello main.cpp)

target_link_libraries(hello ${Foo_LIBRARIES})


may also set include directories ?

If so, I don't like this at all.
It changes the meaning of an existing command.

I would much prefer if instead there was a new command, e.g. 

target_use_targets(hello Foo::FooLibrary)

which would be obviously different from target_link_libraries(), and it would 
also only accept other targets as arguments, not library paths.

If target_link_libraries() is overloaded to do more than its name says (i.e. 
not only linking, but also set include dirs and definitions), IMO this will 
make for hard-to-understand/debug cmake files.
In the example above there is no visible hint that what 
target_link_libraries() actually does. (There is also no hint whether the 
find_package() expects a module or a Config file)


I'd much prefer the following:

find_package(Foo NO_MODULE)

add_executable(hello main.cpp)

target_use_targets(hello Foo::FooLibrary)


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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to