title: correct way to encode/embed version number in program code
body: <p>I would like to embed my software version in my code and later retrieve it from the program binary with a command like argument like <code>-v</code> or <code>--version</code>. As an example some of the GNU/Linux software binaries print their version information when supplied with a <code>-v</code> or <code>-V</code> argument in the command line take <code>ls</code> as an example:</p>
  
  <pre><code>$ ls --version
  ls (GNU coreutils) 8.13
  Copyright (C) 2011 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  </code></pre>
  
  <p>Is there a convention or standard do this? I tried to search for this information but since I didn't know the right terminology my search only resulted in version control howto's. The software code is written in C++ language if it helps to address the problem better.</p>