[CMAKE] Allow overriding the .dll extension for delay imports in MSVC builds. 246/head
authorThomas Faber <thomas.faber@reactos.org>
Sun, 31 Dec 2017 12:08:39 +0000 (13:08 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 1 Jan 2018 18:05:30 +0000 (19:05 +0100)
Fixes delay-importing winspool.drv.

dll/win32/setupapi/CMakeLists.txt
dll/win32/shell32/CMakeLists.txt
sdk/cmake/gcc.cmake
sdk/cmake/msvc.cmake

index 409d9ed..933d661 100644 (file)
@@ -41,7 +41,7 @@ add_library(setupapi SHARED
 
 set_module_type(setupapi win32dll UNICODE)
 target_link_libraries(setupapi uuid wine ${PSEH_LIB})
-add_delay_importlibs(setupapi comdlg32 shell32 winspool wintrust)
+add_delay_importlibs(setupapi comdlg32 shell32 winspool.drv wintrust)
 add_importlibs(setupapi gdi32 comctl32 advapi32 user32 rpcrt4 version msvcrt kernel32 ntdll)
 add_pch(setupapi setupapi_private.h SOURCE)
 add_cd_file(TARGET setupapi DESTINATION reactos/system32 FOR all)
index 46af5e6..8bdf3ee 100644 (file)
@@ -107,7 +107,7 @@ set_source_files_properties(shell32.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT
 
 set_module_type(shell32 win32dll UNICODE)
 target_link_libraries(shell32 shellmenu shelldesktop atlnew wine uuid recyclebin)
-add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool winmm mpr uxtheme ole32 oleaut32 userenv browseui version fmifs)
+add_delay_importlibs(shell32 powrprof shdocvw devmgr winspool.drv winmm mpr uxtheme ole32 oleaut32 userenv browseui version fmifs)
 add_importlibs(shell32 advapi32 gdi32 user32 comctl32 comdlg32 shlwapi msvcrt kernel32 ntdll)
 add_dependencies(shell32 stdole2) # shell32_shldisp.tlb needs stdole2.tlb
 add_pch(shell32 precomp.h SOURCE)
index 41d6a72..d54fc3a 100644 (file)
@@ -326,7 +326,8 @@ function(add_delay_importlibs _module)
         message(FATAL_ERROR "Cannot add delay imports to a static library")
     endif()
     foreach(_lib ${ARGN})
-        target_link_libraries(${_module} lib${_lib}_delayed)
+        get_filename_component(_basename "${_lib}" NAME_WE)
+        target_link_libraries(${_module} lib${_basename}_delayed)
     endforeach()
     target_link_libraries(${_module} delayimp)
 endfunction()
index dd73927..1559677 100644 (file)
@@ -336,8 +336,13 @@ function(add_delay_importlibs _module)
         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()