MantisBT - CMake
View Issue Details
0009997CMakeCMakepublic2009-12-04 10:152011-06-17 12:40
Lluís Batlle 
Brad King 
normalminoralways
closedfixed 
MinGW
CMake-2-6 
CMake 2.8.5CMake 2.8.5 
0009997: .def files are not passed to the mingw linker
The .def files set in the source files for a shared library is correctly passed to the msvc linker through /DEF:..., but they are trimmed off when using the mingw ld linker.
The mingw ld linker follows the rules specified in .def files passed as source inputs.
There is a workaround:
using, under IF(MINGW), LINKER_FLAGS of the style "-Wl,myfile.def" in order to get the .def file included.
No tags attached.
related to 0009613closed Brad King VS2010 generator seems to ignore link_flags and module definition files (.DEFs) 
has duplicate 0011768closed David Cole Mingw target can not process .DEF files 
Issue History
2009-12-04 10:15Lluís BatlleNew Issue
2010-12-14 16:52David ColeAssigned To => Bill Hoffman
2010-12-14 16:52David ColeStatusnew => assigned
2011-02-03 17:47David ColeRelationship addedhas duplicate 0011768
2011-02-21 14:51Brad KingAssigned ToBill Hoffman => Brad King
2011-02-21 14:51Brad KingRelationship addedrelated to 0009613
2011-02-21 14:52Brad KingNote Added: 0025528
2011-02-21 14:56Brad KingStatusassigned => closed
2011-02-21 14:56Brad KingResolutionopen => fixed
2011-02-21 14:56Brad KingPlatform => MinGW
2011-02-21 14:56Brad KingTarget Version => CMake 2.8.5
2011-06-17 12:40David ColeFixed in Version => CMake 2.8.5

Notes
(0025528)
Brad King   
2011-02-21 14:52   
This was mostly addressed by the fixes for issue 0009613:

   http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=024d05ad [^]
   http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0db2c850 [^]

The only thing that is missing is the value of CMAKE_LINK_DEF_FILE_FLAG in the platform files for the GNU toolchain on Windows. I've added the setting and enabled the test for this toolchain:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a61a8a5 [^]

One can work around the problem for any CMake 2.8.[01234] with this code:

  # This platform information is missing in CMake <= 2.8.4.
  if(NOT CMAKE_LINK_DEF_FILE_FLAG AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
    set(CMAKE_LINK_DEF_FILE_FLAG "-Wl,")
  endif()