On Thu, Dec 09, 2010 at 08:44:15AM -0500, Bill Hoffman wrote: > On 12/9/2010 5:26 AM, Gabriel Petrovay wrote: >> Thanks Bill for the trick. >> >> Unfortunately this works only for exe targets. >> It doesn't work for dll's. Moreover, before the link command there is >> this output: "Visual Studio Non-Incremental Link" >> > If it says that then the /INCREMENTAL flag is not being used. You have > to set the CMAKE_SHARED_LINKER_FLAGS_DEBUG flag for this to work with > dlls, may also want to set this one: CMAKE_MODULE_LINKER_FLAGS_DEBUG.
Haven't been following this thread closely, but changing the handling of /INCREMENTAL is a pain, at least in VS 2005 and 2008. Here is some code we use to *disable* /INCREMENTAL. With a little creativity, you could probably use this to forcibly *enable* /INCREMENTAL :): # Disable incremental linking when BUILD_code_quality is enabled as it # causes problems with code coverage builds. # # These link flags are baked in when Windows-cl.cmake is loaded. Thus, # we have to alter several variables. See: "How to turn off incremental # linking for MSVC Debug and RelWithDebInfo targets?" # http://www.cmake.org/pipermail/cmake/2010-February/035174.html # # Example from OpenSceneGraph: # http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.6.0/CMakeLists.txt # # Also remove /EDITANDCONTINUE, which is incompatible with # /INCREMENTAL:NO. foreach (flag_type EXE MODULE SHARED) string (REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" flag_tmp "${CMAKE_${flag_type}_LINKER_FLAGS_DEBUG}") string (REPLACE "/EDITANDCONTINUE" "" flag_tmp "${CMAKE_${flag_type}_LINKER_FLAGS_DEBUG}") set (CMAKE_${flag_type}_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${flag_tmp}" CACHE STRING "Overriding default debug ${flag_type} linker flags." FORCE) mark_as_advanced (CMAKE_${flag_type}_LINKER_FLAGS_DEBUG) endforeach () # Change /ZI to /Zi as /ZI implies /EDITANDCONTINUE, which is mutually # exclusive with INCREMENTAL:NO as set above. Furthermore, this setting # only applies to 32-bit Windows. if (TP_PLATFORM MATCHES "${TP_WIN32}") string (REPLACE "/ZI" "/Zi" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) endif () # Disable this warning: # warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other # libs; use /NODEFAULTLIB:library list (APPEND TP_COMMON_LINK_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRT") hth, tyler _______________________________________________ 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