[MINGW]
[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 list(APPEND 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 tlsmthread.c
31 tlssup.c
32 tlsthrd.c
33 txtmode.c
34 wildcard.c
35 xncommod.c
36 xthdloc.c
37 xtxtmode.c
38 ofmt_stub.c
39 cxa_pure_virtual.c)
40
41 add_library(mingw_common ${MINGW_COMMON_SOURCE})
42
43 if(NOT MSVC)
44 target_link_libraries(mingw_common oldnames)
45 endif(NOT MSVC)
46
47 set_target_properties(mingw_common PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
48 add_dependencies(mingw_common psdk)
49
50 add_library(mingw_main crt0_c.c crtexe.c dllargv.c)
51 set_property(TARGET mingw_main PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
52 add_dependencies(mingw_main psdk)
53
54 add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
55 set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
56 add_dependencies(mingw_wmain psdk)
57
58 add_definitions(-DCRTDLL)
59 add_library(mingw_dllmain crtdll.c dllargv.c)
60 add_dependencies(mingw_dllmain psdk)
61
62 add_custom_command(
63 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
64 COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
65 COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
66
67 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES GENERATED TRUE)
68
69 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
70
71 add_library(getopt getopt.c)
72 set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
73 add_dependencies(getopt psdk)