On 01/04/2014 11:26 PM, Totte Karlsson wrote:

When I build the dll using CMAKE, however, even after adding the .def file, the resulting dll don't have the aliased names.

I have tried adding the def file to sources, but that seem no to work, and setting the module linker flags, e.g. set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} \"/DEF:${CMAKE_CURRENT_SOURCE_DIR}/myllib.def\"")

is not doing it either.

Anyone knowing how to do it properly?

Just listing a .def file in the sources for a target worked for me (using the Microsoft compiler).

Are you using one of the Makefile generators?

In those CMAKE_LINK_DEF_FILE_FLAG seems to be used to handle .def source files.
For the Microsoft compiler this is defined as such:
    set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")

For Borland I don't see any such definition (but I am not really familiar with the Borland setup either).

Your workaround with CMAKE_MODULE_LINKER_FLAGS I expect can only work if you used add_library(foo MODULE) rather than add_library(foo SHARED).
For the later you would have to set CMAKE_SHARED_LINKER_FLAGS.

Nils

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to