MantisBT - CMake
View Issue Details
0005020CMakeCMakepublic2007-05-11 15:272016-06-10 14:30
Jesus Lopez 
Bill Hoffman 
lowfeaturealways
closedmoved 
 
 
0005020: DEF files in MinGW
I'm trying to use a hand made .DEF file (with aliases) to link a
certain DLL with MinGW. I tried this way but with no success:

    project(kaka)
    add_library(kk SHARED kk.c kk.def)

The generated Makefile didn't pass the DEF file to the linking stage.
I would like to see this implemented.

The way to do this by hand would be:
gcc -o kk.dll -shared kk.o kk.def

While other generators use the DEF file, MinGW's simply ignore it.

Thank U!
No tags attached.
Issue History
2011-01-16 09:58MaddesNote Added: 0024729
2016-06-10 14:27Kitware RobotNote Added: 0041357
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0024729)
Maddes   
2011-01-16 09:58   
I can confirm this behaviour with CMake 2.8.3.

The reason is that CMAKE_LINK_DEF_FILE_FLAG is ignored, unless explicitly set to empty.
I assume CMake ignores it as it has still its empty default value, but this is the correct value for GNUC/CC on Windows.

I use the following code as a workaround:
# GCC specialities
if(${CMAKE_COMPILER_IS_GNUCC})
    if(${WIN32})
        set(CMAKE_LINK_DEF_FILE_FLAG "") # CMake workaround (2.8.3)
        set(CMAKE_SHARED_LIBRARY_PREFIX "") # DLLs do not have a "lib" prefix
        set(CMAKE_IMPORT_LIBRARY_PREFIX "") # same for DLL import libs
    endif()
endif()
(0041357)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.