diff options
-rw-r--r-- | lets_not_store_versions_in_versioned_files.html | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lets_not_store_versions_in_versioned_files.html b/lets_not_store_versions_in_versioned_files.html index dc6479b..8872383 100644 --- a/lets_not_store_versions_in_versioned_files.html +++ b/lets_not_store_versions_in_versioned_files.html @@ -85,13 +85,15 @@ git_describe(VERSION) configure_file(version.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/version.cpp @ONLY) target_sources(version-print PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) </pre> -<p>Now, CMake does not support this out-of-box sadly, so you need to implement <code>git_describe</code> yourself or get -an external module for it. There is one in +<p>Now, CMake does not support this out-of-box sadly, so you need to implement <code>git_describe</code> (or similar) +yourself or get an external module for it. There is one in <a href="https://github.com/rpavlik/cmake-modules/blob/main/GetGitRevisionDescription.cmake">Ryan A. Pavlik's repository</a> and I have implemented <a href="https://git.ignore.pl/starshatter/tree/cmake/modules/GitDescribe.cmake">one for Starshatter</a> at some point. -They are rather easy and fun to write (altough there is a variety of edge cases), but it's still a bit shame that they -are not part of the core CMake. +They are rather easy and fun to write (although there is a variety of edge cases), but it's still a bit shame that they +are not part of the core CMake. Now, note that one of these "edge cases" might be triggering the reconfiguration of the +output file as <code>configure_file</code> is configuration-time action and changes to the output of the +<code>git_describe</code> may or may not be properly detected. Be wary. <p>Alternatively, you can consider using a define to, well, define the version number. I use this approach with separate file that defines the variable for the sake of dependency checks and recompilation. <h2>Final Thoughts</h2> |