MantisBT - CMake
View Issue Details
0010492CMakeCMakepublic2010-03-31 00:212016-06-10 14:31
Conrad 
Bill Hoffman 
normalminoralways
closedmoved 
CMake-2-8 
 
0010492: CMAKE_CXX_STACK_SIZE parameter incorrectly handled when generating Visual Studio 2010 projects
Added this line to our CMakeLists.txt file:
  SET( CMAKE_CXX_STACK_SIZE "20000000" )
Generated VS 2010 .vcxproj file, compiled, linked, got error:
  LINK : fatal error LNK1104: cannot open file '20000000.obj'

The one-line fix to this problem is in cmVisualStudio10TargetGenerator.cxx, in cmVisualStudio10TargetGenerator::WriteLinkOptions, change:
  if(stackVal)
    {
    flags += " ";
    flags += stackVal;
    }
to:
  if(stackVal)
    {
    flags += " /STACK:";
    flags += stackVal;
    }

I applied the above fix to my local build of CMake, and now the CMAKE_CXX_STACK_SIZE option properly sets the "Stack Reserve Size" field in Visual Studio and the program links and runs just fine.
No tags attached.
Issue History
2010-03-31 00:21ConradNew Issue
2010-07-10 21:27ConradNote Added: 0021347
2010-07-10 21:31ConradNote Edited: 0021347
2010-12-14 18:23David ColeAssigned To => Bill Hoffman
2010-12-14 18:23David ColeStatusnew => assigned
2010-12-14 18:23David ColeNote Added: 0023997
2012-03-02 02:11ConradNote Added: 0028782
2016-06-10 14:27Kitware RobotNote Added: 0041677
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0021347)
Conrad   
2010-07-10 21:27   
(edited on: 2010-07-10 21:31)
Ping! Does adding this comment make this bug show up on someone's radar?

CMAKE_CXX_STACK_SIZE is an obscure flag, but it is a CMake feature that's totally broken for VS 2010.

The one-line (7-character) fix described above (change flags += " " to flags += " /STACK:") will take < 5 minutes for you to commit.

Thank you!

(0023997)
David Cole   
2010-12-14 18:23   
Bill, is this still like this in git next and master?
(0028782)
Conrad   
2012-03-02 02:11   
The good news: I just downloaded CMake 2.8.7 and Visual Studio 2011 Beta and was happy to see that CMake generally works great with VS 2011!

The bad news: This bug still exists. I haven't checked to see if VS 2010 and VS 2011 share the same project file generators, but it's either still a 7-character code fix or perhaps it has now become a 14-character code fix.

The fix: change 'flags += " "' to 'flags += " /STACK:"'
(0041677)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.