[CMake] CMake variable to set stack size

Gautham B A bagautham at yahoo.com
Fri Nov 1 02:23:32 EDT 2019


Hi,

Is there a CMake variable to set the stack size of a target?
Upon searching the issues, I came across this one - https://gitlab.kitware.com/cmake/cmake/issues/17572 . It says that there is a CMake variable CMAKE_CXX_STACK_SIZE, but it isn’t clear whether CMAKE_CXX_STACK_SIZE can be used.
Further, the CMake documentation doesn’t seem to have anything on CMAKE_CXX_STACK_SIZE - https://cmake.org/cmake/help/v3.16/search.html?q=CMAKE_CXX_STACK_SIZE&check_keywords=yes&area=default

I’ve managed to set the stack size by setting the linker flag based on the compiler –
if (MSVC)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000")
else ()
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10000000")
endif()

Having a CMake variable to set the stack size would greatly simplify things. Could anybody please give more info on this?

Thanks,
--Gautham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191101/2714e5e0/attachment.html>


More information about the CMake mailing list