cmake: add support for shared library compiling