[CMake] Creating dependencies between static imported targets.

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sun Aug 21 05:37:11 EDT 2016


Am 21.08.2016 um 09:24 schrieb Yaron Cohen-Tal:
> Hi,
>
> Using ""target_link_libraries" between static libraries is allowed, 
> however doing it with static imported targets fails with:
>
> "Cannot specify link libraries for target "<target name>" which is not 
> built by this project.
>
> However, this is necessary in order to define dependencies between the 
> targets, which is necessary when solving dependencies (when those 
> targets are eventually linked into e.g. an executable built by the 
> project). How, then, can I create dependencies between imported targets?
INTERFACE_LINK_LIBRARIES is what you're looking for. See also 
https://cmake.org/cmake/help/v3.5/manual/cmake-buildsystem.7.html#imported-targets 
for more information.

HTH,
Christian



More information about the CMake mailing list