[CMake] /STACK:10000000 being added to linker in Visual Studio?
David Cole
david.cole at kitware.com
Wed Jun 27 15:23:09 EDT 2012
Put double quotes around the final ${flags} here, like this:
string( REGEX REPLACE "/STACK:[0-9]+" "" flags "${flags}" )
Otherwise, if ${flags} is empty, string(REGEX REPLACE will complain
that it doesn't have any input string. Using the "" around it tells
the command it really does have 6 arguments even if the final one is
just the empty string.
Even though the variable is named CMAKE_EXE_LINKER_FLAGS, I think it
applies to dll targets, too, and that's the root source of the target
property's initial value. So using my technique should obviate the
need for this code.
On Wed, Jun 27, 2012 at 3:19 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> This flag is appended to DLL targets too, so I created this (i haven't
> tested it yet though):
>
> function( _remove_stack_flag target_name )
> get_property( flags TARGET ${target_name} PROPERTY COMPILE_FLAGS )
> string( REGEX REPLACE "/STACK:[0-9]+" "" flags ${flags} )
> set_property( TARGET ${target_name} PROPERTY COMPILE_FLAGS ${flags} )
> endfunction()
>
> I call this once for each target I define.
>
>
> On Wed, Jun 27, 2012 at 2:17 PM, David Cole <david.cole at kitware.com> wrote:
>>
>> You could do:
>>
>> string(REPLACE "/STACK:10000000 " "" CMAKE_EXE_LINKER_FLAGS
>> "${CMAKE_EXE_LINKER_FLAGS}")
>>
>> after the first project command in the top level CMakeLists file. (Or
>> "/STACK:some other number" to change it, instead of the empty string
>> to just remove it...)
>>
>> The /STACK string only appears in the two files:
>>
>> Modules/Platform/Windows-Intel.cmake
>> Modules/Platform/Windows-cl.cmake
>>
>>
>> HTH,
>> David
>>
>>
>> On Wed, Jun 27, 2012 at 3:11 PM, Robert Dailey <rcdailey.lists at gmail.com>
>> wrote:
>> > This is added to every generated visual studio project from version 7.1
>> > to
>> > 9. How can I tell CMake not to modify the stack size?
>> > --
>> >
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the CMake FAQ at:
>> > http://www.cmake.org/Wiki/CMake_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.cmake.org/mailman/listinfo/cmake
>
>
More information about the CMake
mailing list