So I'm building a shared library, out of two static libraries.
This answer says the way to do it is to insert -Wl,--whole-archive
before my static libs, the -Wl,--no-whole-archive
after them.
So what I have in cmake at the moment for the shared library is:
add_library(wittyPlus SHARED empty.cpp)
target_link_libraries(wittyPlus
${wtdbosqlite}
${WT_LIBRARIES}
${DB_LIBRARIES}
${Boost_LIBRARIES}
app models
)
So what I need is for it to add the -Wl,--whole-archive
before app
and models
, then -Wl,--no-whole-archive
after them (so that the standard library imports don't get exported by the shared lib).
What's the easiest way to do this in CMake ?
Addition: So I'd like to use the standard cmake stuff as much as possible, that way I don't have to do any extra work for windows builds, as CMake kindly removes the compiler definitions that aren't supported on the platform being built.