[CMake] Is there an elegant way to get list of object files participating into a library?
Hendrik Sattler
post at hendrik-sattler.de
Mon Feb 28 02:38:40 EST 2011
Zitat von Vladislav Vaintroub <vvaintroub at googlemail.com>:
>> 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)
It's better to have a well-defined API, so you should know what
symbols to export...
Additionally, since gcc can also be selective about the symbols to
export, maybe adding the proper export flags in the code would also be
a solution.
HS
More information about the CMake
mailing list