I have a need to create a versioning mechanism for an application we are developing.
The version needs to be the following format: VERSION.RELEASE.MAINTENANCE.PATCH. This is nothing special till now, just 4 numbers. CMake will generate a header with these numbers and this file will be included in the required places to retrieve the version number.
But here comes my question: Where should I store these four numbers?
The following places was I thinking to store them:
So, here is the question:
What best practices can you suggest for achieving this?
EDIT (answer to comment from LB):
The builds will be required for the trunk version (but not for any revision, just the "top"), tagged versions and special development branches.
From my point of view (I am currently involved into several (non-large) projects, based on CMake, and have seen many other projects, based on different build platforms):
CMakeLists.txt
, auxiliary file, etc.) is preferrable.For such project human failure in changing version number inside code is almost impossible because of well-defined business process.
From the other side, source code become separable from repository(SVN). So you able to deliver source code, e.g., as a simple archive.
In such project human failure in release versions are more frequent, so reducing number of manual steps always has a sence.
From the other side, full support for several ways to deliver source files is not common in small projects. It is sufficient to support downloading sources only via SVN.
In case of parsing repository data for getting version number, it is better to have file-level dependency of CMake script from that data. Otherwise, having tagged revision differed from previous one only in source files, you may have incorrect version number after these steps:
cmake
)make
).Because none of CMake script dependencies are changed on step 4, build at step 5 will not involve automatic reconfiguration, so version number will not be regenerated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With