[CMake] Creating a dynamic library with a static library hidden inside

Michael Leong michael at voltage.com
Tue Jun 16 13:30:57 EDT 2009


Hi all,

I'm using CMake 2.6, and want to make a dynamic library that contains a static library inside. In more detail, I'm trying to take an openssl static library and compile it into a dynamic library, without the openssl routines being externally visible. Is it possible to do this, and if so, how? I tried to use something like the code below, but it still required me to link in openssl when I tried to link an executable using the constructed dynamic library.

        add_library(libeay-static STATIC IMPORTED)
        set_property(TARGET libeay-static PROPERTY IMPORTED_LOCATION win32/lib/libeay32.lib)
        add_library(ssleay-static STATIC IMPORTED)
        set_property(TARGET ssleay-static PROPERTY IMPORTED_LOCATION win32/lib/ssleay32.lib)
        target_link_libraries(dynlib libeay-static ssleay-static)

In sum, I need two things:
1: A dynamic library containing openssl which does not require me to link in openssl if I want to use it to make an executable.
2: The dynamic library's internal openssl functions should not be externally visible.

Thanks in advance.
-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090616/d088db63/attachment.htm>


More information about the CMake mailing list