[CMake] How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?
Erwin Coumans
erwin.coumans at gmail.com
Mon Feb 15 18:30:06 EST 2010
Thanks John, it has been a painful cmake experience to turn off incremental
linking for debug builds.
Apparently, the SET(MSVC_INCREMENTAL_DEFAULT ON) has to appear before the
PROJECT line, otherwise it doesn't work.
Here is the solution that works for me, hope this saves others time:
----------------------------------
#this line has to go before PROJECT
SET(MSVC_INCREMENTAL_DEFAULT ON)
PROJECT(BULLET_PHYSICS)
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags
${CMAKE_EXE_LINKER_FLAGS_DEBUG})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${replacementFlags}" )
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags3
${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/INCREMENTAL:NO
${replacementFlags3}" )
----------------------------------
On 11 February 2010 16:04, John Drescher <drescherjm at gmail.com> wrote:
> On Thu, Feb 11, 2010 at 6:46 PM, Erwin Coumans <erwin.coumans at gmail.com>
> wrote:
> >
> > I can't find where this INCREMENTAL:YES is coming from.
> > Is there a better way than hacking the 'cmLocalVisualStudio7Generator
> > ::GetBuildTypeLinkerFlags'
> > to replace INCREMENTAL:YES by INCREMENTAL:NO?
> > Thanks a lot,
> > Erwin
>
> I think it is set in here:
>
> cmake-2.8\Modules\Platform\Windows-cl.cmake
>
>
> # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add
> pdbtyp
> # on versions that support it
> SET( MSVC_INCREMENTAL_YES_FLAG "")
> IF(NOT MSVC_INCREMENTAL_DEFAULT)
> SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
> ENDIF()
>
> IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
> SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept
> ${MSVC_INCREMENTAL_YES_FLAG}")
> SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug
> /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
> ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
> SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug
> ${MSVC_INCREMENTAL_YES_FLAG}")
> SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug
> ${MSVC_INCREMENTAL_YES_FLAG}")
> ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
> # for release and minsize release default to no incremental linking
>
> John
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100215/38c3ecf1/attachment.htm>
More information about the CMake
mailing list