[CMake] Linking to libraries that depend on other libraries
David Doria
daviddoria at gmail.com
Thu May 17 16:50:48 EDT 2012
On Thu, May 17, 2012 at 2:18 AM, Petr Kmoch <petr.kmoch at gmail.com> wrote:
> Hi David,
>
> there's a target property LINK_INTERFACE_LIBRARIES (and
> per-configuration variants) which can be used for this purpose.
> Starting with 2.8.7, target_link_libraries() also accepts
> LINK_INTERFACE_LIBRARIES as a new argument mode, setting the property
> instead of linking.
>
> Petr
Petr,
I tried the following, but in both cases (target_link_libraries
and set_target_properties) I still get a linker error that it can't find
TestB().
cmake_minimum_required(VERSION 2.6)
PROJECT(Test)
add_library(TestB TestB.cpp)
# TestA depends on TestB
add_library(TestA TestA.cpp)
#target_link_libraries(TestA LINK_INTERFACE_LIBRARIES TestB)
set_target_properties(TestA PROPERTIES LINK_INTERFACE_LIBRARIES "TestB")
# I want to link to TestA and have it automatically also link to TestB
add_executable(Test Test.cpp)
target_link_libraries(Test TestA)
I have uploaded the entire demo project here:
http://homepages.rpi.edu/~doriad/Upload/TestCMake.tar.gz
Any ideas?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120517/21cb6c4e/attachment.htm>
More information about the CMake
mailing list