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

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


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake