[CMake] Linking external static libraries into dlls

Tyler Roscoe tyler at cryptio.net
Thu Mar 4 13:49:24 EST 2010


On Thu, Mar 04, 2010 at 06:30:02PM +0100, Christoph Höger wrote:
> I am currently trying to link a DLL with the netcdf_c++ static library
> in the hope I will not have to redistribute netcdf itself. (I thought
> the DLL could contain the needed code itself).

This should work. Be careful, though. I think symbols from the static
lib will only show up in your DLL if code in your DLL uses those symbols
-- that is, not all symbols from the static lib are automatically
imported into your DLL. This is all IIRC.

> target_library_add({${myLib} ${netcdf_c++.lib})

This is not a CMake command and google has never heard of it. If this is
a macro in your CMake system, we'll need to see its contents before we
can comment on it.

tyler


More information about the CMake mailing list