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

Gabriel Petrovay gabipetrovay at gmail.com
Wed Dec 8 13:49:45 EST 2010


On Wed, Dec 8, 2010 at 7:09 PM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> 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.

I am building in debug mode.

> 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

I don't know how can incremental linking work because mt.exe modifies
the timestmp of the dll (after the last link.exe was called),
therefore according to the linker documentation
(http://msdn.microsoft.com/en-us/library/4khtbfyf(v=VS.100).aspx),
this is a case in which link.exe will fully link.

>> 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.

So, what happens with the debug build?

> All is working as expected.
>
> -Bill
>



-- 
MSc Gabriel Petrovay
Mobile: +41(0)787978034
www.28msec.com


More information about the CMake mailing list