on Windows link libgcc statically to reduce the number of dlls
authorkoda
Tue, 28 May 2013 15:38:28 +0200
changeset 9068 3401390f03cf
parent 9066 86289794d421
child 9069 24a2da6e5a22
on Windows link libgcc statically to reduce the number of dlls
CMakeLists.txt
tools/build_windows.bat
--- a/CMakeLists.txt	Mon May 27 21:34:03 2013 -0400
+++ b/CMakeLists.txt	Tue May 28 15:38:28 2013 +0200
@@ -211,6 +211,10 @@
 
 #set default flags values for all projects (unless MINIMAL_FLAGS is true)
 if(NOT ${MINIMAL_FLAGS})
+    if(WINDOWS)
+        #this flags prevents a few dll hell problems
+        set(CMAKE_C_FLAGS "-static-libgcc ${CMAKE_C_FLAGS}")
+    endif(WINDOWS)
     set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
     set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
     set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}")
--- a/tools/build_windows.bat	Mon May 27 21:34:03 2013 -0400
+++ b/tools/build_windows.bat	Tue May 28 15:38:28 2013 +0200
@@ -13,7 +13,8 @@
 if %BUILD_TYPE%=="Debug" (
     for %%G in (QtCored4 QtGuid4 QtNetworkd4) do xcopy /d/y %QTDIR%\%%G.dll %CD%\bin\
 )
-for %%G in (QtCore4 QtGui4 QtNetwork4 libgcc_s_dw2-1 mingwm10) do (
+:: should you libgcc dynamically you should try adding libgcc_s_dw2-1 and mingwm10
+for %%G in (QtCore4 QtGui4 QtNetwork4) do (
     xcopy /d/y %QTDIR%\%%G.dll %CD%\bin\
 )