[CMake] Compiling dll under MSVC 2008

Hendrik Sattler post at hendrik-sattler.de
Thu Apr 16 14:29:27 EDT 2009


Am Donnerstag 16 April 2009 19:48:03 schrieb Mike Jackson:
> You will want to read this link
> <http://www.cmake.org/Wiki/BuildingWinDLL>
[...]
> PS: Feedback on that article is also welcome.

In OpenObex, we use additionally a .def file with exports. "obex.sym" is a list 
of symbol names (one per line) and is also used by libtool:

if ( MSVC )\r
  set ( OPENOBEX_DEF_FILE "${CMAKE_CURRENT_BINARY_DIR}/openobex.def" )
  file ( WRITE "${OPENOBEX_DEF_FILE}"
        "VERSION ${openobex_VERSION_MAJOR}.${openobex_VERSION_MINOR}\n"
       )
  file ( APPEND "${OPENOBEX_DEF_FILE}" "EXPORTS\n" )
  file ( READ "${CMAKE_CURRENT_SOURCE_DIR}/obex.sym" OPENOBEX_SYMBOLS )
  file ( APPEND "${OPENOBEX_DEF_FILE}" "${OPENOBEX_SYMBOLS}\n" )
endif ( MSVC )

You have to use this to get sensible symbol names that you can use from 
language bindings when using WINAPI.

OTOH, it should be sufficient to add a link to the right VisualStudio 
documentation. Almost everything regarding windows DLLs with msvc is described 
there, and lots better than what gcc provides as documentation (mostly 
cryptic).

HS



More information about the CMake mailing list