22e78c3695348a42e3495f7a73f378b2017daad6
[reactos.git] / lib / 3rdparty / mingw / CMakeLists.txt
1
2 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/mingw-w64)
3
4 add_definitions(-D_CRTBLD -Wno-main)
5
6 set(MINGW_COMMON_SOURCE
7 _newmode.c
8 atonexit.c
9 binmode.c
10 charmax.c
11 cinitexe.c
12 CRT_fp10.c
13 CRT_fp8.c
14 CRT_glob.c
15 crt_handler.c
16 dllentry.c
17 gccmain.c
18 gs_support.c
19 merr.c
20 mingw_helpers.c
21 natstart.c
22 pesect.c
23 pseudo-reloc.c
24 pseudo-reloc-list.c
25 tlsmcrt.c
26 tlssup.c
27 tlsthrd.c
28 txtmode.c
29 wildcard.c
30 xncommod.c
31 xthdloc.c
32 xtxtmode.c
33 ofmt_stub.c
34 cxa_pure_virtual.c
35 )
36
37 add_library(mingw_common ${MINGW_COMMON_SOURCE})
38 target_link_libraries(mingw_common oldnames -lkernel32 -lntdll)
39 set_target_properties(mingw_common PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
40 add_dependencies(mingw_common psdk)
41
42 add_library(mingw_main crt0_c.c crtexe.c dllargv.c)
43 set_property(TARGET mingw_main PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
44 add_dependencies(mingw_main psdk)
45
46 add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
47 set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
48 add_dependencies(mingw_wmain psdk)
49
50 add_library(mingw_dllmain crtdll.c dllargv.c)
51 add_dependencies(mingw_dllmain psdk)
52
53 add_custom_command(
54 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
55 COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
56 COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
57 )
58
59 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES GENERATED TRUE)
60
61 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
62
63 add_library(getopt getopt.c)
64 set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
65 add_dependencies(getopt psdk)