https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b20280a0f9d64c91fb2680e2220f3984f82ad343

commit b20280a0f9d64c91fb2680e2220f3984f82ad343
Author: Thomas Faber <[email protected]>
AuthorDate: Sun Dec 31 13:08:39 2017 +0100

    [CMAKE] Allow overriding the .dll extension for delay imports in MSVC 
builds.
    
    Fixes delay-importing winspool.drv.
---
 dll/win32/setupapi/CMakeLists.txt | 2 +-
 dll/win32/shell32/CMakeLists.txt  | 2 +-
 sdk/cmake/gcc.cmake               | 3 ++-
 sdk/cmake/msvc.cmake              | 9 +++++++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/dll/win32/setupapi/CMakeLists.txt 
b/dll/win32/setupapi/CMakeLists.txt
index 409d9edf86..933d66111a 100644
--- a/dll/win32/setupapi/CMakeLists.txt
+++ b/dll/win32/setupapi/CMakeLists.txt
@@ -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)
diff --git a/dll/win32/shell32/CMakeLists.txt b/dll/win32/shell32/CMakeLists.txt
index 46af5e6e32..8bdf3ee56f 100644
--- a/dll/win32/shell32/CMakeLists.txt
+++ b/dll/win32/shell32/CMakeLists.txt
@@ -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)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index 41d6a721cb..d54fc3a93e 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -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()
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index dd7392756e..1559677fb4 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -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()

Reply via email to