[CMake] Is there an elegant way to get list of object files participating into a library?

Vladislav Vaintroub vvaintroub at googlemail.com
Sun Feb 27 20:42:50 EST 2011


> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On
> Behalf Of Pere Mato Vila
> Sent: Sonntag, 27. Februar 2011 22:38
> To: cmake at cmake.org
> Subject: [CMake] Is there an elegant way to get list of object files
> participating into a library?
> 
> Hi,
> 
>   For the Windows platform  I am generating the .DEF files with all
defined
> symbols to be exported.  For this  I need to get the list of all object
files (.obj)
> participating into a library. 

Are you trying to export all symbols from a shared library, something that
emulates Unix linkers behavior  (Microsoft  linker has no option for it=?

If it is so, then you can create a static library first. Then  add custom
command that e.g runs dumpbin  with you static library to extract symbols
and produces .DEF (for example using a script like this one
http://kenai.com/projects/mysql-jvm/sources/source/content/win/create_def_fi
le.js?rev=25 ). Finally, to produce DLL,  use a  dummy source file , and
your generated .DEF and link the DLL to the static library, like

ADD_LIBRARY(mydll SHARED dummy.c generated.def)
TARGET_LINK_LIBRARIES(mydll staticlib)

Vladislav



More information about the CMake mailing list