I am trying to implement some auto-versioning so that I don't have to manually check I am staying up to date with my software versions. To do this, I figured I would dynamically set a preprocessor macro with the current date and time.
In SmartSnippets, I can go to settings, C/C++ Build->Cross ARM C Compiler-> Preprocessor settings, then Defined symbols (-D) to add what I want. My exact syntax here is: BLACKORCA_SW_VERSION="\"C$(date +"%Y.%m.%d.%H.%M")\"" with the intention that "date" calls the shell command to get the current date and is subsequently formatted how I want. I also want the "C" prefix.
I have tested this syntax with gcc locally, and it works great. When I try to skirt around SmartSnippets and call "make" manually from a terminal (invoking the proper cross compiler instead of gcc) and from the project build folder, I can see the output of this correctly resolves to the current date and time. But, when I go through SmartSnippets and my Build Configuration, the macro is properly recognized to be defined (no compiler errors), but when I flash my board (I have a dev board and a custom board), the macro ends up being resolved to "C" only, and the rest of the string does not show up.
I know this is a super specific request, but if the macro resolves correctly for me when locally using gcc, and when using arm-none-eabi-gcc while manually calling make from a terminal, then there might be something SmartSnippets/Eclipse related that I need help with.
Any advice? If there is an easier way to implement this auto-versioning, please do let me know. Thanks.