From a9be04d9d9d80aae9cf9ba0008665b62a4adb2fd Mon Sep 17 00:00:00 2001 From: Mickael Savinaud <mickael.savinaud@c-s.fr> Date: Mon, 17 Feb 2014 14:55:28 +0100 Subject: [PATCH] BUG: change the size of the stack if necessary to use OTB6S code --- CMake/CommonDefinitions.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMake/CommonDefinitions.cmake b/CMake/CommonDefinitions.cmake index a5e6450a79..70dbf3de36 100644 --- a/CMake/CommonDefinitions.cmake +++ b/CMake/CommonDefinitions.cmake @@ -4,6 +4,18 @@ if(WIN32) # do not build shared lib under windows set(BUILD_SHARED_LIBS OFF) message(STATUS "Disabling build shared lib option on windows like OS.") + + # 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 (${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(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000" CACHE STRING "Flags used by the linker" FORCE) + message(STATUS "Increase the size of the stack to 10Mbytes.") + endif() + endif() + else() # on other systems, leave the choice to the user option(BUILD_SHARED_LIBS "Build OTB with shared libraries." ON) -- GitLab