From f655f86d82f59276d35cfbcf1222629e116b784a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 9 Nov 2010 20:43:09 +0000 Subject: [PATCH] [MINGW] special stuff for MSVC svn path=/branches/cmake-bringup/; revision=49543 --- lib/3rdparty/mingw/CMakeLists.txt | 9 ++++-- lib/3rdparty/mingw/mscmain.c | 49 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 lib/3rdparty/mingw/mscmain.c diff --git a/lib/3rdparty/mingw/CMakeLists.txt b/lib/3rdparty/mingw/CMakeLists.txt index 6d813a89e96..92603584fc0 100644 --- a/lib/3rdparty/mingw/CMakeLists.txt +++ b/lib/3rdparty/mingw/CMakeLists.txt @@ -18,7 +18,6 @@ list(APPEND MINGW_COMMON_SOURCE CRT_glob.c crt_handler.c dllentry.c - gccmain.c gs_support.c merr.c mingw_helpers.c @@ -38,6 +37,12 @@ list(APPEND MINGW_COMMON_SOURCE 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}) if(NOT MSVC) @@ -69,5 +74,5 @@ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a PROPERTIES add_custom_target(oldnames ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/liboldnames.a) add_library(getopt getopt.c) -set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL __USE_CRTIMP) +set_property(TARGET getopt PROPERTY COMPILE_DEFINITIONS _DLL1 __USE_CRTIMP) add_dependencies(getopt psdk) diff --git a/lib/3rdparty/mingw/mscmain.c b/lib/3rdparty/mingw/mscmain.c new file mode 100644 index 00000000000..110cd1ab38f --- /dev/null +++ b/lib/3rdparty/mingw/mscmain.c @@ -0,0 +1,49 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include +#include + +int _fltused; + +void +_cdecl +_alloca_probe_16(void) +{ +} + +void +__do_global_dtors (void) +{ + +} + +void +__do_global_ctors (void) +{ + +} + +BOOL +WINAPI +_CRT_INIT0(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) +{ + return TRUE; +} + +static int initialized = 0; + +void +__main (void) +{ + if (!initialized) + { + initialized = 1; + __do_global_ctors (); + } +} + +