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

Pere Mato Vila Pere.Mato at cern.ch
Mon Feb 28 04:53:22 EST 2011


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

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

I have done what you proposed and works fine if I use the static library. Unfortunately the utility I use to extract the symbols, which is orders of magnitude faster than anything based on dumpbin,  works at the level of the object files. This is why I am interested to get the list of them. 

-------------------------------------------------------------
Pere Mato  CERN, PH Department, CH 1211 Geneva 23, Switzerland
          e-mail: pere.mato at cern.ch      tel: +41 22 76 78696
          fax:  +41 22 76 68792            gsm: +41 76 48 70855




More information about the CMake mailing list