[cmake-developers] Bad handling of /STACK:reserve[, commit] linker flag

Brad King brad.king at kitware.com
Wed Dec 3 11:43:46 EST 2014


On 12/03/2014 10:57 AM, Robert Goulet wrote:
> trying to pass the linker flag "/STACK:reserve[,commit]"
[snip]
> Visual Studio linker requires us to pass the 'commit' argument like this:
> 
>  /STACK:"2048"",1024"

For the VS generators CMake needs to parse the arguments and transform
them into the proper IDE project property settings.  At the time this was
designed almost all MS tool flags conformed to a simple pattern.  It is
parsed here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmIDEOptions.cxx;hb=v3.0.2#l33

and mapped through a lookup table to get the IDE setting.  The entry for
"/STACK:" is here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmVS10LinkFlagTable.h;hb=v3.0.2#l263

and maps to StackReserveSize.  Note the comment about StackCommitSize
not being supported currently.

However, some flags do not conform to this pattern and need special
hard-coded handling in the parser.  The StoreUnknownFlag method does
this:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmVisualStudioGeneratorOptions.cxx;hb=v3.0.2#l176

Someone will have to remove /STACK: from the standard flag tables and
add explicit handling to StoreUnknownFlag to split the value into the
separate StackReserveSize and StackCommitSize properties.

-Brad


More information about the cmake-developers mailing list