From 32da9ddc6c2d7cbaabc23b3736e84113418bf5e9 Mon Sep 17 00:00:00 2001
From: Rashad Kanavath <rashad.kanavath@c-s.fr>
Date: Mon, 26 Oct 2015 14:19:15 +0100
Subject: [PATCH] BUG: bug_stack_6s different flag needed for mingw

---
 CMake/OTBSetStandardCompilerFlags.cmake | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake
index 40d105d13e..2cf8c6b129 100644
--- a/CMake/OTBSetStandardCompilerFlags.cmake
+++ b/CMake/OTBSetStandardCompilerFlags.cmake
@@ -135,16 +135,19 @@ macro(check_compiler_platform_flags)
   # Since CMake 2.8.11, the size of the stack is not modified by CMake on
   # windows platform, it uses the default size: with visual compiler it is 1Mbyte
   # which is to lower for us (thanks to 6S code).
-  if(WIN32)
+  if(MSVC)
     if (${CMAKE_VERSION} VERSION_GREATER "2.8.10.2")
       if("${CMAKE_EXE_LINKER_FLAGS}" MATCHES "/STACK:[0-9]+")
           message(STATUS "The size of the stack is already defined, so we dont't modified it.")
       else()
           set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} /STACK:10000000")
-          message(STATUS "Increase the size of the stack to 10Mbytes.")
+          message(STATUS "The stack size is set to 10 Mbytes (/STACK:10000000).")
       endif()
-    endif()
-  endif()
+    endif() #if (${CMAKE_VERSION..
+  else(MINGW)
+    set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} -Wl,--stack,10000000")
+    message(STATUS "The stack size is set to 10 Mbytes (-Wl,--stack,10000000).")
+  endif() # if(MSVC)
 
   # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
   # warnings
-- 
GitLab