Adding a Subversion version string in binary

Technical Note 57192

Arkitekturer:

All

Komponent:

IDE

Uppdaterad:

2018-02-08 06:14

Introduction

How to add a version string from Subversion in the executable?

Discussion

Possible solution

Use the Subversion program svnversion.exe to produce version strings.

  • Set a pre-build action to call an appropriate script.
  • Create a script creating a C source file with a version string.
  • Include the created C source in your project.
  • Do not include the created C source in your version archive.
  • Optionally, use the version string in your code.
    • If so, suggest to create and use a headerfile as done in the example code.
  • Optionally, add a post-build action to remove the created C source.

Download Example (TN57192).zip for more details.

You may want to look at the screenshots in the example file first.

Comments

Has been tested

  • with IAR Embedded Workbench for ARM version 6.50.3.
  • with IAR Embedded Workbench for AVR version 6.20.2.
  • on Microsoft Windows 7 64-bit.
  • with path including blanks.
  • with path on another drive letter.
  • with path on a UNC share (in other words, \\server\share\path).

Set Tools > Options > Messages > Show build messages > 'All' to get messages from bat file in the Build Log window.

Conclusion

Follow this advice to get a Subversion version string added in the executable.

All product names are trademarks or registered trademarks of their respective owners.

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.