[CMake] Did anyone manage to get incremental linking working with NMake generator?

Bill Hoffman bill.hoffman at kitware.com
Wed Dec 8 13:09:21 EST 2010


On 12/8/2010 12:53 PM, Gabriel Petrovay wrote:
> Hi Bill,
>
> First just by running "cmake -E vs_link_exe" CMake crashes on my
> machine (CMake 2.8.2, Win7): "cmake.exe stopped working" "Close the
> program/Debug the program". Is this the right behaviour?
>
It is not meant to be a command that is called by hand, so it might not 
have all the arguments it wants, and it crashed.  Not expected, but not 
that harmful either.

> Then, below is my verbose output. I see no /INCREMENTAL:YES in my link
> command. How did you get this in your link command? (This is anyway
> the default option.)
Are you building Release?  I think CMake only defaults to incremental 
builds for debug builds.  So, RELWITHDEBINFO and DEBUG build types will 
be the only ones that do this by default.

You would want to add the incremental flag to this cache variable to get 
CMake to link incrementally with release:
  CMAKE_EXE_LINKER_FLAGS_RELEASE

> The problem is that calling mt.exe after linking modifies the
> timestamp of the dll. Therefore the next run of nmake will trigger a
> full link as the below output shows:
> LINK : zorba_simplestore.dll not found or not built by the last
> incremental link; performing full link
> But I already had the dll built by a previous build.
>
Yes, it does that for release builds, as the exe and dll files do not 
have the extra space needed for incremental linking.  Basically, CMake 
supports incremental and non-incremental linking.  If the 
/INCREMENTAL:YES flag is found then cmake -E vs_link_exe is used.  If 
not, then the non-incremental approach is taken.


All is working as expected.

-Bill


More information about the CMake mailing list