Reputation: 131385
Suppose I'm creating a target for an already-compiled library, foo.so
. Now, this library has the following requirements/dependencies, as specified by ldd
:
linux-gate.so.1 (0xf77d4000)
libm.so.6 => /lib/libm.so.6 (0xf5de7000)
libc.so.6 => /lib/libc.so.6 (0xf5c0c000)
libdl.so.2 => /lib/libdl.so.2 (0xf5c07000)
libpthread.so.0 => /lib/libpthread.so.0 (0xf5be8000)
librt.so.1 => /lib/librt.so.1 (0xf5bde000)
/lib/ld-linux.so.2 (0xf77d5000)
I'm now wondering which packages I should have to look for and utilize as INTERFACE_LINK_LIBRARIES.
I'm assuing I need:
find_package(Threads REQUIRED)
target_link_libraries(foo INTERFACE Threads::Threads)
and also
target_link_libraries(foo INTERFACE INTERFACE ${CMAKE_DL_LIBS}))
but what about all the rest of those items? For rt
, I could write,for example
if(UNIX AND NOT APPLE)
target_link_libraries(foo INTERFACE INTERFACE rt) # Not 100% sure this is necessary
endif()
should I? And what about the other libraries?
Note: I'm not asking for help determining what the right CMake package name is for these libraries. My question is, for each of them - whether I should just ignore the fact that they're listed and hope that things will turn out alright, or - whether I should do something about them in my CMakeLists.txt
.
Upvotes: 0
Views: 44