@@ -332,6 +332,11 @@ function(fixup_load_config _target)
332332 # msvc knows how to generate a load_config so no hacks here
333333endfunction ()
334334
335+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
336+ CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
337+ set (__spec2def_dbg_arg "--dbg" )
338+ endif ()
339+
335340function (generate_import_lib _libname _dllname _spec_file __version_arg)
336341
337342 set (_def_file ${CMAKE_CURRENT_BINARY_DIR} /${_libname} _implib.def)
@@ -341,7 +346,7 @@ function(generate_import_lib _libname _dllname _spec_file __version_arg)
341346 # Generate the def, asm stub and alias files
342347 add_custom_command (
343348 OUTPUT ${_asm_stubs_file} ${_def_file} ${_asm_impalias_file}
344- COMMAND native-spec2def --ms ${__version_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR} /${_spec_file}
349+ COMMAND native-spec2def --ms ${__version_arg} ${__spec2def_dbg_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR} /${_spec_file}
345350 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${_spec_file} native-spec2def)
346351
347352 # Compile the generated asm stub file
@@ -414,7 +419,7 @@ function(spec2def _dllname _spec_file)
414419 # Generate exports def and C stubs file for the DLL
415420 add_custom_command (
416421 OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${_file} .def ${CMAKE_CURRENT_BINARY_DIR} /${_file} _stubs.c
417- COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR} /${_file} .def -s=${CMAKE_CURRENT_BINARY_DIR} /${_file} _stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR} /${_spec_file}
422+ COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR} /${_file} .def -s=${CMAKE_CURRENT_BINARY_DIR} /${_file} _stubs.c ${__with_relay_arg} ${__version_arg} ${__spec2def_dbg_arg} ${ CMAKE_CURRENT_SOURCE_DIR} /${_spec_file}
418423 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /${_spec_file} native-spec2def)
419424
420425 # Do not use precompiled headers for the stub file
0 commit comments