On 10/5/2011 9:47 AM, Stephen Kelly wrote:
Thanks for all of your explanations. It seems that introducing a way to do
this with one command has some support.

So if SOME_FEATURE is true,

target_link_libraries(foo bar SOME_KEYWORD baz)
if (SOME_FEATURE)
   target_link_libraries(foo mar SOME_KEYWORD maz)
endif()

would have to result in bar and mar not being part of the link interface,
and baz and maz being part of the link interface.

How do we decide on a keyword there? LINK_INTERFACE_DEPENDENCIES perhaps?

One possible problem with making it a keyword is that the name could appear
in a list of libraries and invisibly transform a target_link_libraries call.
What we need is a pair of keywords to switch between link+interface and
link-only dependencies.  We allow the keywords only if one of the two is
the second argument to the command after the target name.  For example,
they can be called "LINK_INTERFACE" for link+interface and "LINK_DEPENDS"
for link-only:

  target_link_libraries(foo LINK_INTERFACE bar LINK_DEPENDS baz)
  if(SOME_FEATURE)
    target_link_libraries(foo LINK_INTERFACE mar LINK_DEPENDS maz)
  endif()

Other possible names?  Perhaps LINK_PUBLIC and LINK_PRIVATE?
Perhaps LINK AND LINK_ONLY?

-Brad
--

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