CMake: how create a single shared library from all static libraries of subprojects?
I have the following layout: top_project + subproject1 + subproject2 Each of subproject1 and subproject2 creates a static library. I would like to link these static libraries in a single shared library at the top_project level. The information I gathered so far is: Either compile using -fPic (necessary on everything but Windows) in order to create position-independent code which will allow linking the static libraries into a single shared library or decompress all static libraries (e.g. using ar ) and re-link them into a shared library (which I think is an inelegant & non-portable solution)