diff options
author | Aki <please@ignore.pl> | 2023-01-28 20:07:34 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-01-28 20:07:34 +0100 |
commit | 57cb84d321b9874bd84ac74df75215ed174498ee (patch) | |
tree | a63ab584fcf733a4bd3692212e34d57e8a520492 /lets_not_store_versions_in_versioned_files.html | |
parent | d1ad9cf75269f2a660bbe0f74013b76253c0a4a7 (diff) | |
download | ignore.pl-57cb84d321b9874bd84ac74df75215ed174498ee.zip ignore.pl-57cb84d321b9874bd84ac74df75215ed174498ee.tar.gz ignore.pl-57cb84d321b9874bd84ac74df75215ed174498ee.tar.bz2 |
Added a sentence about reconfiguration of the cmake in version
Diffstat (limited to 'lets_not_store_versions_in_versioned_files.html')
-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> |