[CMAKE]
authorThomas Faber <thomas.faber@reactos.org>
Sun, 14 Jul 2013 11:44:21 +0000 (11:44 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 14 Jul 2013 11:44:21 +0000 (11:44 +0000)
- Do not allow add_delay_importlibs to be called on static libraries

svn path=/trunk/; revision=59481

reactos/cmake/gcc.cmake
reactos/cmake/msvc.cmake

index 6559071..a74cd77 100644 (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")
index 0258ed5..8a6821b 100644 (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)