CMake variable to set stack size

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

CMake variable to set stack size

CMake mailing list



Is there a CMake variable to set the stack size of a target?

Upon searching the issues, I came across this one - . 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 -


I’ve managed to set the stack size by setting the linker flag based on the compiler –

if (MSVC)


else ()

   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10000000")



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





Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: