- Do not allow add_delay_importlibs to be called on static libraries

svn path=/trunk/; revision=59481
This commit is contained in:
Thomas Faber 2013-07-14 11:44:21 +00:00
parent 53dbf738e5
commit f76d810d43
2 changed files with 16 additions and 8 deletions

View file

@ -211,11 +211,15 @@ function(set_module_type_toolchain MODULE TYPE)
endif()
endfunction()
function(add_delay_importlibs MODULE)
function(add_delay_importlibs _module)
get_target_property(_module_type ${_module} TYPE)
if(_module_type STREQUAL "STATIC_LIBRARY")
message(FATAL_ERROR "Cannot add delay imports to a static library")
endif()
foreach(LIB ${ARGN})
target_link_libraries(${MODULE} lib${LIB}_delayed)
target_link_libraries(${_module} lib${LIB}_delayed)
endforeach()
target_link_libraries(${MODULE} delayimp)
target_link_libraries(${_module} delayimp)
endfunction()
if(NOT ARCH STREQUAL "i386")

View file

@ -128,13 +128,17 @@ endfunction()
#define those for having real libraries
set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "LINK /LIB /NOLOGO <LINK_FLAGS> /OUT:<TARGET> <OBJECTS>")
set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /Cp /Fo<OBJECT> /c /Ta <SOURCE>")
macro(add_delay_importlibs MODULE)
function(add_delay_importlibs _module)
get_target_property(_module_type ${_module} TYPE)
if(_module_type STREQUAL "STATIC_LIBRARY")
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})
add_target_link_flags(${_module} "/DELAYLOAD:${LIB}.dll")
target_link_libraries(${_module} lib${LIB})
endforeach()
target_link_libraries(${MODULE} delayimp)
endmacro()
target_link_libraries(${_module} delayimp)
endfunction()
function(generate_import_lib _libname _dllname _spec_file)