[CMAKE] Implement PCH builds with target_precompile_headers. CORE-16905
[reactos.git] / dll / win32 / msxml3 / CMakeLists.txt
index 8a7ee4e..b11bdf3 100644 (file)
@@ -1,6 +1,7 @@
 
 add_definitions(
     -D__WINESRC__
+    -D__ROS_LONG64__
     -D_WINE
     -DLIBXML_STATIC
     -DCOM_NO_WINDOWS_H)
@@ -9,8 +10,11 @@ if(MSVC)
     add_compile_flags("/FIwine/typeof.h /FImsvc.h")
 endif()
 
-include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
-spec2def(msxml3.dll msxml3.spec ADD_IMPORTLIB)
+include_directories(
+    ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine
+    ${REACTOS_SOURCE_DIR}/sdk/lib/3rdparty/libwin-iconv)
+
+spec2def(msxml3.dll msxml3.spec ADD_IMPORTLIB NO_PRIVATE_WARNINGS)
 add_typelib(msxml3_v1.idl)
 
 list(APPEND SOURCE
@@ -43,11 +47,16 @@ list(APPEND SOURCE
     xmldoc.c
     xmlelem.c
     xmlparser.c
-    xmlview.c
+    xmlview.c)
+
+list(APPEND PCH_SKIP_SOURCE
+    factory.c
+    uuid.c
     xslpattern.tab.c
-    xslpattern.yy.c
-    precomp.h
-    ${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c)
+    xslpattern.yy.c)
+
+# xslpattern.tab.c/xslpattern.yy.c have been generated with relative file paths...
+set_source_files_properties(xslpattern.tab.c xslpattern.yy.c PROPERTIES COMPILE_FLAGS "-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
 
 list(APPEND msxml3_rc_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/msxml3.manifest
@@ -57,17 +66,17 @@ list(APPEND msxml3_rc_deps
 
 set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS "${msxml3_rc_deps}")
 
-add_library(msxml3 SHARED
+add_library(msxml3 MODULE
     ${SOURCE}
-    factory.c
-    uuid.c
+    ${PCH_SKIP_SOURCE}
     version.rc
+    ${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c
     ${CMAKE_CURRENT_BINARY_DIR}/msxml3.def)
 
 add_idl_headers(xmlparser_idlheader xmlparser.idl)
 set_module_type(msxml3 win32dll)
-target_link_libraries(msxml3 libxml2 iconv-static uuid wine)
+target_link_libraries(msxml3 libxml2 iconv-static uuid wine zlib)
 add_importlibs(msxml3 urlmon ws2_32 shlwapi oleaut32 ole32 user32 msvcrt kernel32 ntdll)
 add_dependencies(msxml3 xmlparser_idlheader stdole2) # msxml3_v1.tlb needs stdole2.tlb
-add_pch(msxml3 precomp.h SOURCE)
+add_pch(msxml3 precomp.h "${PCH_SKIP_SOURCE}")
 add_cd_file(TARGET msxml3 DESTINATION reactos/system32 FOR all)