I am porting an AutoTools project to CMake.
What AutoTools does:
- builds some static libraries
- builds some shared libraries and links static ones into shared
- builds an executable, links it to shared libraries
What I've managed to do with CMake:
- build some static libraries -
add_library(staticfoo <src>)
- build some shared libraries -
add_library(sharedfoo SHARED <src>)
and link them -target_link_libraries(sharedfoo staticfoo)
- build an executable, link it to shared libraries -
target_link_libraries(exe sharedfoo)
, but that dragged the static libraries in again, too.
So, the resulting link command for the executable has static libs in addition to shared. Which doesn't correspond to the command generated by AutoTools project.
I've tried target_link_libraries(sharedfoo PRIVATE staticfoo)
, but that doesn't get the symbols from the static lib into the interface of the shared lib.
How to get the symbols without that 'transitive' behavior?
(in platform-independent way)