[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 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)
45 add_importlibs(mingw_common kernel32 ntdll oldnames)
46 add_dependencies(mingw_common oldnames)
47 endif(NOT MSVC)
48
49 set_target_properties(mingw_common PROPERTIES COMPILE_DEFINITIONS _M_CEE_PURE)
50 add_dependencies(mingw_common psdk)
51
52 add_library(mingw_main crt0_c.c crtexe.c dllargv.c)
53 set_property(TARGET mingw_main PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
54 add_dependencies(mingw_main psdk)
55
56 add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
57 set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
58 add_dependencies(mingw_wmain psdk)
59
60 add_library(mingw_dllmain crtdll.c dllargv.c)
61 add_dependencies(mingw_dllmain psdk)
62
63 add_custom_command(
64 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
65 COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
66 COMMAND ${MINGW_PREFIX}ar -rc ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
67
68 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES GENERATED TRUE)
69
70 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
71
72 add_library(getopt getopt.c)
73 set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
74 add_dependencies(getopt psdk)