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

Tyler Roscoe tyler at cryptio.net
Tue Jun 16 17:46:01 EDT 2009


On Tue, Jun 16, 2009 at 10:30:57AM -0700, Michael Leong wrote:
>         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)

I haven't worked with IMPORTED libs but this looks reasonable.

Are you sure those .lib files are static libraries and not import
libraries?

> 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.

AFAIK what you're doing ought to work. Maybe since this is Windows you
need some symbol decoration magic (declspec)?

> 2: The dynamic library's internal openssl functions should not be
> externally visible.

Not sure if this is possible. If the symbols are in there, someone with
dumpbin or some other tool will probably be able to find them. What are
you trying to do? Why is this requirement important? Also, are there any
legal/licensing ramifications of doing this?

What problems are you running into? Can't compile dynlib? Can't link an
exe with dynlib?


More information about the CMake mailing list