Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have Visual Studio check for file-checksum instead of timestamp to determine which file needs to be rebuilt

Currently I'm managing a huge C++ pullrequest which I (git) rebase regularly on the origin's master to keep it up-to-date.

However Visual Studio seems to rebuild all sources after a rebase because the timestamp of most files changed but the content of most files stayed the same (CMake is used as build system).

Is there a way to tell Visual Studio compiler to check whether the file content stayed the same (through checksums) instead of using the last timestamp written to the file to prevent it from rebuilding my huge solution?

like image 574
Denis Blank Avatar asked Nov 26 '15 01:11

Denis Blank


People also ask

Can same file have different checksum?

It is possible that different files have the same checksum (in fact, since there are a finite number of checksums but an infinite number of possible files, there must be an infinite number of different files that have the same checksum). But it is not possible for identical files to have different checksums.

What is the use of file checksum?

A checksum is a string of numbers and letters used to uniquely identify a file. Checksum is most commonly used to verify if a copy of a file is identical to an original, such as downloaded copies of ArcGIS product installation or patch files.


1 Answers

A workaround would be to write a script/small software, and include it in the pre-build actions, that checks the before and after source files and if the content has not changed (via a checksum), then it changes the creation date of the after-source file to match the already compiled obj.

Or, even better, the script could be responsible for the source file copying, and it doesn't even copy a source file if its content is the same as the old source.

I don't think VS Builder has such a native option.

like image 129
vulkanino Avatar answered Sep 20 '22 05:09

vulkanino