[CMAKE]
[reactos.git] / reactos / 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()
9
10 list(APPEND MINGW_COMMON_SOURCE
11 _newmode.c
12 atonexit.c
13 binmode.c
14 charmax.c
15 cinitexe.c
16 CRT_glob.c
17 crt_handler.c
18 dllentry.c
19 gs_support.c
20 merr.c
21 mingw_helpers.c
22 natstart.c
23 pesect.c
24 pseudo-reloc.c
25 pseudo-reloc-list.c
26 tlsmcrt.c
27 tlsmthread.c
28 tlssup.c
29 tlsthrd.c
30 txtmode.c
31 wildcard.c
32 xncommod.c
33 xthdloc.c
34 xtxtmode.c
35 ofmt_stub.c
36 cxa_pure_virtual.c)
37
38 if(MSVC)
39 list(APPEND MINGW_COMMON_SOURCE mscmain.c)
40 else()
41 list(APPEND MINGW_COMMON_SOURCE gccmain.c)
42 endif()
43
44 add_library(mingw_common ${MINGW_COMMON_SOURCE})
45
46 if(NOT MSVC)
47 target_link_libraries(mingw_common oldnames)
48 endif()
49
50 set_target_properties(mingw_common PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
51 add_dependencies(mingw_common psdk)
52
53 add_library(mingw_main crt0_c.c crtexe.c dllargv.c)
54 set_property(TARGET mingw_main PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
55 add_dependencies(mingw_main psdk)
56
57 add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
58 set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
59 add_dependencies(mingw_wmain psdk)
60
61 add_library(mingw_dllmain crtdll.c dllargv.c)
62 set_property(TARGET mingw_dllmain PROPERTY COMPILE_DEFINITIONS CRTDLL _WINDOWS_)
63 add_dependencies(mingw_dllmain psdk)
64
65 if(NOT MSVC)
66 add_custom_command(
67 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
68 COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
69 COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
70
71 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES GENERATED TRUE)
72
73 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
74 endif()
75
76 add_library(getopt getopt.c)
77 set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
78 add_dependencies(getopt psdk)