[cmake-developers] Setting the link interface and dependencies in one command
Stephen Kelly
steveire at gmail.com
Thu Oct 6 20:54:46 EDT 2011
Stephen Kelly wrote:
>> Other possible names? Perhaps LINK_PUBLIC and LINK_PRIVATE?
>> Perhaps LINK AND LINK_ONLY?
>
> I'll implement it as you suggest with LINK_PUBLIC and LINK_PRIVATE, which
> are most clear to me. We can change it once we have an implementation to
> talk about.
Well that didn't take long. I pushed a target-link-libraries-interfaces
branch to stage.
In the branch:
target_link_libraries(foo
LINK_PRIVATE
qtxml
LINK_PUBLIC
qtcore
qtnetwork
)
and
target_link_libraries(foo
LINK_PUBLIC
qtcore
qtnetwork
LINK_PRIVATE
qtxml
)
are equivalent to:
target_link_libraries(foo
qtcore
qtnetwork
qtxml
)
target_link_libraries(foo
LINK_INTERFACE_LIBRARIES
qtcore
qtnetwork
)
both mean:
* foo will link against qtxml, qtcore and qtnetwork
* qtcore and qtnetwork will be in the LINK_INTERFACE_LIBRARIES
...
target_link_libraries(foo
LINK_PUBLIC
qtcore
qtnetwork
)
is equivalent to
target_link_libraries(foo
qtcore
qtnetwork
)
* foo will link against qtcore and qtnetwork
...
target_link_libraries(foo
LINK_PRIVATE
qtcore
)
is equivalent to:
target_link_libraries(foo
qtcore
)
target_link_libraries(foo
TARGET_LINK_LIBRARIES ""
)
* foo will link against qtcore
* qtcore will not be in the LINK_INTERFACE_LIBRARIES
...
target_link_libraries(foo
LINK_PRIVATE
qtxml
)
target_link_libraries(foo
LINK_PUBLIC
qtcore
qtnetwork
)
is equivalent to:
target_link_libraries(foo
qtcore
qtxml
qtnetwork
)
target_link_libraries(foo
TARGET_LINK_LIBRARIES
qtcore
qtnetwork
)
* foo will link against qtxml, qtcore and qtnetwork
* qtcore and qtnetwork will be in the LINK_INTERFACE_LIBRARIES
What do you think?
Thanks,
Steve.
More information about the cmake-developers
mailing list