message(FATAL_ERROR "Cannot add delay imports to a static library")
endif()
foreach(_lib ${ARGN})
- add_target_link_flags(${_module} "/DELAYLOAD:${_lib}.dll")
- target_link_libraries(${_module} lib${_lib})
+ get_filename_component(_basename "${_lib}" NAME_WE)
+ get_filename_component(_ext "${_lib}" EXT)
+ if(NOT _ext)
+ set(_ext ".dll")
+ endif()
+ add_target_link_flags(${_module} "/DELAYLOAD:${_basename}${_ext}")
+ target_link_libraries(${_module} "lib${_basename}")
endforeach()
target_link_libraries(${_module} delayimp)
endfunction()