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