1
2spec2def(custom.dll custom.spec)
3add_library(msi_custom MODULE custom.c ${CMAKE_CURRENT_BINARY_DIR}/custom.def)
4set_target_properties(msi_custom PROPERTIES OUTPUT_NAME "custom")
5target_link_libraries(msi_custom uuid)
6set_module_type(msi_custom win32dll)
7add_importlibs(msi_custom msi ole32 oleaut32 odbccp32 shell32 advapi32 msvcrt kernel32)
8
9spec2def(selfreg.dll selfreg.spec)
10add_library(msi_selfreg MODULE selfreg.c ${CMAKE_CURRENT_BINARY_DIR}/selfreg.def)
11set_target_properties(msi_selfreg PROPERTIES OUTPUT_NAME "selfreg")
12set_module_type(msi_selfreg win32dll)
13add_importlibs(msi_selfreg advapi32 msvcrt kernel32)
14
15list(APPEND SOURCE
16    action.c
17    automation.c
18    db.c
19    format.c
20    install.c
21    msi.c
22    package.c
23    patch.c
24    record.c
25    source.c
26    suminfo.c
27    typelib.idl)
28
29list(APPEND PCH_SKIP_SOURCE
30    ${CMAKE_CURRENT_BINARY_DIR}/typelib_i.c
31    testlist.c)
32
33# CMake 3.9 and higher requires to specify this dependency manually
34# see https://gitlab.kitware.com/cmake/cmake/issues/19933
35set_property(SOURCE msi_winetest.rc PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/custom.dll  ${CMAKE_CURRENT_BINARY_DIR}/selfreg.dll ${CMAKE_CURRENT_BINARY_DIR}/typelib.tlb)
36
37add_executable(msi_winetest
38    ${SOURCE}
39    ${PCH_SKIP_SOURCE}
40    msi_winetest.rc)
41
42add_idl_headers(msi_winetest_idlheader typelib.idl)
43generate_idl_iids(typelib.idl)
44add_typelib(typelib.idl)
45
46target_compile_definitions(msi_winetest PRIVATE __WINESRC__ USE_WINE_TODOS)
47
48if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
49    target_compile_options(msi_winetest PRIVATE -Wno-format-overflow -Wno-format)
50    target_compile_options(msi_custom PRIVATE -Wno-format)
51endif()
52
53# msi_winetest.rc: let rc.exe find custom.dll in its subdirectory, i.e. Debug.
54if (MSVC_IDE)
55    target_include_directories(msi_winetest PRIVATE $<$<COMPILE_LANGUAGE:RC>:$<TARGET_FILE_DIR:msi_custom>>)
56endif()
57
58target_link_libraries(msi_winetest uuid)
59set_module_type(msi_winetest win32cui)
60add_importlibs(msi_winetest secur32 cabinet msi shell32 ole32 oleaut32 odbccp32 user32 advapi32 version msvcrt kernel32)
61add_pch(msi_winetest precomp.h "${PCH_SKIP_SOURCE}")
62add_rostests_file(TARGET msi_winetest)
63add_dependencies(msi_winetest msi_custom msi_selfreg msi_winetest_idlheader stdole2)
64