[CMAKE]
[reactos.git] / lib / 3rdparty / mingw / CMakeLists.txt
index 8390d6c..fa46245 100644 (file)
@@ -8,35 +8,38 @@ add_definitions(-Wno-main)
 endif(NOT MSVC)
 
 list(APPEND MINGW_COMMON_SOURCE
-  _newmode.c
-  atonexit.c
-  binmode.c
-  charmax.c
-  cinitexe.c
-  CRT_fp10.c
-  CRT_fp8.c
-  CRT_glob.c
-  crt_handler.c
-  dllentry.c
-  gccmain.c
-  gs_support.c
-  merr.c
-  mingw_helpers.c
-  natstart.c
-  pesect.c
-  pseudo-reloc.c
-  pseudo-reloc-list.c
-  tlsmcrt.c
-  tlsmthread.c
-  tlssup.c
-  tlsthrd.c
-  txtmode.c
-  wildcard.c
-  xncommod.c
-  xthdloc.c
-  xtxtmode.c
-  ofmt_stub.c
-  cxa_pure_virtual.c)
+    _newmode.c
+    atonexit.c
+    binmode.c
+    charmax.c
+    cinitexe.c
+    CRT_glob.c
+    crt_handler.c
+    dllentry.c
+    gs_support.c
+    merr.c
+    mingw_helpers.c
+    natstart.c
+    pesect.c
+    pseudo-reloc.c
+    pseudo-reloc-list.c
+    tlsmcrt.c
+    tlsmthread.c
+    tlssup.c
+    tlsthrd.c
+    txtmode.c
+    wildcard.c
+    xncommod.c
+    xthdloc.c
+    xtxtmode.c
+    ofmt_stub.c
+    cxa_pure_virtual.c)
+
+if(MSVC)
+list(APPEND MINGW_COMMON_SOURCE mscmain.c)
+else()
+list(APPEND MINGW_COMMON_SOURCE gccmain.c)
+endif()
 
 add_library(mingw_common ${MINGW_COMMON_SOURCE})
 
@@ -55,9 +58,11 @@ add_library(mingw_wmain crt0_w.c crtexe.c dllargv.c)
 set_property(TARGET mingw_wmain PROPERTY COMPILE_DEFINITIONS WPRFLAG UNICODE _UNICODE)
 add_dependencies(mingw_wmain psdk)
 
+add_definitions(-DCRTDLL -D_WINDOWS_)
 add_library(mingw_dllmain crtdll.c dllargv.c)
 add_dependencies(mingw_dllmain psdk)
 
+if (NOT MSVC)
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
   COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/moldname-msvcrt.def --kill-at --output-lib ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a
@@ -66,7 +71,8 @@ add_custom_command(
 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES GENERATED TRUE)
 
 add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a)
+endif()
 
 add_library(getopt getopt.c)
-set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP)
-add_dependencies(getopt psdk)
\ No newline at end of file
+set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL1 __USE_CRTIMP)
+add_dependencies(getopt psdk)