[CMake] creating static library with references to other .lib files

Jesper Eskilson jesper at eskilson.se
Tue Jun 12 17:36:06 EDT 2007


2007/6/12, Brandon Van Every <bvanevery at gmail.com>:
>
>
> On some platforms, I bet the underlying linker AR can't even do it.  I
> know it can't put static libraries inside of static libraries, thats' why
> everyone wants "convenience libraries" and I had to work on all that object
> file fakery.  Possibly it can't take a DLL stub .lib either.  So, if there
> is a solution for some platforms, it's not likely to be portable.
>
> I don't know what the MSVC linker can accomplish.  Would suggest reading
> the MSVC docs to make sure it can be done.
>

I *know* that it can be done, since our current hand-written .vcproj files
do it. I simply want CMake to allow me to create a static library using a
command line such as:

lib /out:mystaticlib.lib foo.obj bar.obj mydll.lib

where mydll.lib is an import lib for mydll.dll.

What you're asking for seems kinda weird.  What's the motive?
> <http://www.cmake.org/mailman/listinfo/cmake>


foo.obj and bar.obj uses symbols in mydll.dll, and I want to allow users of
mystatic.lib to just have to link with mystaticlib.lib, and not with
mydll.lib.

Note that an import library on Windows *is* a static library (both having
the .lib suffix is not a coincidence). The only special thing with an import
library is that it exports symbols with a note that the symbol really should
be found at runtime in the given dll. So,

lib /out:foo.lib bar.obj fie.lib

puts all the contents of bar.obj and fie.lib into foo.lib. This is very
practical.

Hope that makes it a little clearer.

-- 
/Jesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070612/8490b0ed/attachment.htm


More information about the CMake mailing list