Is there any possibility to redefine __DATE__
and __TIME__
predefined C++ macros (give them other than default values) in Microsoft Visual Studio?
I tried compiler option /D "__DATE__=\"Feb 10 2021\""
but I'm getting:
pch.cpp : warning C4117: macro name '__DATE__' is reserved, '#define' ignored
and no effect. Any idea except modification of the code (or a confirmation 'it is not possible')?
Reason: C++ project, that I have, has its builds versioned by date macro values (every build gets its version from __DATE__
/__TIME__
values). I need to simulate an "older" build - basically, to cheat this versioning system. I don't need to change the macro value format. I also know about an option to have another user-defined macro mentioned by @Jabberwocky.