How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

Erwin Coumans-2


I've search a while and noticed several similar requests, but couldn't find a solution that works.

http://www.mail-archive.com/cmake@.../msg19612.html
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=45160
http://www.ogre3d.org/forums/viewtopic.php?t=28115&view=previous&sid=4671d7d566b65f8a4475bad1da67c78f

	STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags ${CMAKE_EXE_LINKER_FLAGS_DEBUG}) 
	message (${replacementFlags})
	SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags}) 
		
		
	STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS}) 
	message (${replacementFlags2})
	SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2}) 
	
Is there a method using CMake 2.8 or CMake 2.8.1 that works?
Thanks a lot,
Erwin



_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

Erwin Coumans-2

It would be great to have an answer on this, did I miss it in the FAQs?

How can we switch off incremental linking for Debug and RelWithDebInfo target on Windows Visual Studio projects?

Thanks a lot,
Erwin


On 8 February 2010 11:44, Erwin Coumans <[hidden email]> wrote:


I've search a while and noticed several similar requests, but couldn't find a solution that works.

http://www.mail-archive.com/cmake@.../msg19612.html
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=45160
http://www.ogre3d.org/forums/viewtopic.php?t=28115&view=previous&sid=4671d7d566b65f8a4475bad1da67c78f

	STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags ${CMAKE_EXE_LINKER_FLAGS_DEBUG}) 
	message (${replacementFlags})
	SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags}) 
		
		
	STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS}) 
	message (${replacementFlags2})
	SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2}) 
	
Is there a method using CMake 2.8 or CMake 2.8.1 that works?
Thanks a lot,
Erwin




_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

John Drescher-2
>> STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags
>> ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
>> message (${replacementFlags})
>> SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags})
>>
>>
>> STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2
>> ${CMAKE_EXE_LINKER_FLAGS})
>> message (${replacementFlags2})
>> SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
>>
>>
>> Is there a method using CMake 2.8 or CMake 2.8.1 that works?
>>

I thought that the following worked in the past since I have this in
my CMakeLists.txt:
 SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO /MANIFEST /STACK:10000000 ")

but it appears that this no longer works with cmake 2.8.0. I believe
it worked previously.

I do not have a solution for this yet.

John
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

Erwin Coumans-2

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




//----------------------------------------------------------------------------
std::string
cmLocalVisualStudio7Generator
::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName)
{
  std::string configTypeUpper = cmSystemTools::UpperCase(configName);
  std::string extraLinkOptionsBuildTypeDef = 
    rootLinkerFlags + "_" + configTypeUpper;

  std::string extraLinkOptionsBuildType =
    this->Makefile->GetRequiredDefinition
    (extraLinkOptionsBuildTypeDef.c_str());

  cmSystemTools::ReplaceString(extraLinkOptionsBuildType, "/INCREMENTAL:YES", "/INCREMENTAL:NO");

  return extraLinkOptionsBuildType;
}


On 9 February 2010 11:40, John Drescher <[hidden email]> wrote:
>>      STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags
>> ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
>>      message (${replacementFlags})
>>      SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags})
>>
>>
>>      STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2
>> ${CMAKE_EXE_LINKER_FLAGS})
>>      message (${replacementFlags2})
>>      SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
>>
>>
>> Is there a method using CMake 2.8 or CMake 2.8.1 that works?
>>

I thought that the following worked in the past since I have this in
my CMakeLists.txt:
 SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO /MANIFEST /STACK:10000000 ")

but it appears that this no longer works with cmake 2.8.0. I believe
it worked previously.

I do not have a solution for this yet.

John


_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

John Drescher-2
On Thu, Feb 11, 2010 at 6:46 PM, Erwin Coumans <[hidden email]> 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
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: How to turn off incremental linking for MSVC Debug and RelWithDebInfo targets?

Erwin Coumans-2

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 <[hidden email]> wrote:
On Thu, Feb 11, 2010 at 6:46 PM, Erwin Coumans <[hidden email]> 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


_______________________________________________
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