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

commit 93d741c3f41f190e9f3dabb8c5c753e71731bc7f
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Tue Feb 2 16:18:04 2021 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Mar 3 08:34:32 2021 +0100

    [SHLWAPI] Use an object library to separate C & C++ compilation units
    
    CORE-17423
---
 dll/win32/shlwapi/CMakeLists.txt | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dll/win32/shlwapi/CMakeLists.txt b/dll/win32/shlwapi/CMakeLists.txt
index 076aaa4dcd6..af8ec781824 100644
--- a/dll/win32/shlwapi/CMakeLists.txt
+++ b/dll/win32/shlwapi/CMakeLists.txt
@@ -27,21 +27,28 @@ list(APPEND SOURCE
     url.c)
 
 list(APPEND PCH_SKIP_SOURCE
-    autocomp.cpp
     wsprintf.c
     ${CMAKE_CURRENT_BINARY_DIR}/shlwapi_stubs.c)
 
 add_library(shlwapi MODULE
     ${SOURCE}
     ${PCH_SKIP_SOURCE}
+    $<TARGET_OBJECTS:shlwapi_autocomp>
     shlwapi.rc
     ${CMAKE_CURRENT_BINARY_DIR}/shlwapi.def)
 
 # our C++ atlbase.h conflicts with the one from wine, so only use wine 
includes for C
-target_include_directories(shlwapi BEFORE PRIVATE 
$<$<COMPILE_LANGUAGE:C>:${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine>)
+# Unfortunately, we can't use different includes for C & C++ in VS generator, 
so use an object library to achieve this
+target_include_directories(shlwapi BEFORE PRIVATE 
${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
+
+add_library(shlwapi_autocomp OBJECT autocomp.cpp)
+target_link_libraries(shlwapi_autocomp PRIVATE atl_classes)
+target_compile_definitions(shlwapi_autocomp PRIVATE 
$<TARGET_PROPERTY:shlwapi,COMPILE_DEFINITIONS>)
+target_compile_options(shlwapi_autocomp PRIVATE 
$<TARGET_PROPERTY:shlwapi,COMPILE_OPTIONS>)
+add_dependencies(shlwapi_autocomp psdk)
 
 set_module_type(shlwapi win32dll UNICODE)
-target_link_libraries(shlwapi uuid wine cpprt atl_classes)
+target_link_libraries(shlwapi uuid wine cpprt)
 add_delay_importlibs(shlwapi userenv oleaut32 ole32 comdlg32 mpr mlang urlmon 
shell32 winmm version)
 add_importlibs(shlwapi user32 gdi32 advapi32 wininet msvcrt kernel32 ntdll)
 add_pch(shlwapi precomp.h "${PCH_SKIP_SOURCE}")

Reply via email to