Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / cmake / msvc.cmake
index 0258ed5..b92107b 100644 (file)
@@ -127,14 +127,18 @@ 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)
-    foreach(LIB ${ARGN})
-        add_target_link_flags(${MODULE} "/DELAYLOAD:${LIB}.dll")
-        target_link_libraries(${MODULE} lib${LIB})
+set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <SOURCE>")
+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})
     endforeach()
-    target_link_libraries(${MODULE} delayimp)
-endmacro()
+    target_link_libraries(${_module} delayimp)
+endfunction()
 
 function(generate_import_lib _libname _dllname _spec_file)