[cmake-developers] Watcom import library fails if no symbols in the DLL

J Decker d3ck0r at gmail.com
Thu Feb 27 15:39:17 EST 2014


I was recently communicating with openwatcom matinainers; which just
released a version 2.0 fork on sourceforge... but the issue was
basically... if I have a shared library with no exports, it fails to build.

I used to use a method...(and this is how cmake does it)

wlink (...)  # build library
wlib (...) # build import library from wlink output

but doing it this way if the .dll has no exports, wlib results in an error,
and faults the build.

I was informed that the correct way is to build the import library during
the wlink step using 'option implib[=libname]'

I was able to successfully modify

./share/cmake-2.8/Modules/Platform/Windows-wcl386.cmake

** remove  at line 42

#set(CMAKE_C_CREATE_IMPORT_LIBRARY
#  "wlib -c -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'")
#set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
#

** modify line 69 (65 if 4 lines deleted)
 "wlink ${CMAKE_START_TEMP_FILE} system nt_dll  ${CMAKE_WLINK_QUIET} name
'<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact  file {<OBJECTS>}
<LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")

to include "option implib=<TARGET_IMPLIB>"

 "wlink ${CMAKE_START_TEMP_FILE} system nt_dll  ${CMAKE_WLINK_QUIET} name
'<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> option
caseexact  file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")


and then the next line...

set(CMAKE_CXX_CREATE_SHARED_LIBRARY
  ${CMAKE_CXX_CREATE_SHARED_MODULE}
  ${CMAKE_CXX_CREATE_IMPORT_LIBRARY})

Includes a reference to the IMPORT_LIBRARY symbol removed before so that
can be removed.



Please update this for the future
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140227/e05f30f6/attachment.html>


More information about the cmake-developers mailing list