From Farshid Lashkari, "I noticed that CMake forces a high stack size by default for all MSVC projects. This can cause problems for applications that use a lot of threads. I've added a new option MSVC_USE_DEFAULT_STACK_SIZE that will remove the explicit stack size and use the default MSVC size. Apparently this was only necessary for very old versions of MSVC but it's still around. I would argue that this option should be on by default, but I've left it off for now.

"
This commit is contained in:
Robert Osfield 2010-03-15 15:01:21 +00:00
parent 1b6adccdc4
commit 2b7fb78c75

View File

@ -206,6 +206,15 @@ IF(WIN32)
IF(MSVC_DISABLE_CHECKED_ITERATORS)
ADD_DEFINITIONS(-D_SECURE_SCL=0)
ENDIF(MSVC_DISABLE_CHECKED_ITERATORS)
OPTION(MSVC_USE_DEFAULT_STACK_SIZE "Set to ON to use the default Visual C++ stack size. CMake forces a high stack size by default, which can cause problems for applications with large number of threads." OFF)
MARK_AS_ADVANCED(MSVC_USE_DEFAULT_STACK_SIZE)
IF(MSVC_USE_DEFAULT_STACK_SIZE)
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)
ENDIF()
#needed for net plugin