Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why add a version number with CMake when it can be done with git?

In CMake's Tutorial, under the section "Adding a Version Number and Configured Header File", it explains how to add a version number to a project.

Why do this with CMake when version-control tools (such as git) already allow you to specify a version number?

What, if anything, is to be gained from specifying a project's version number in CMake as well as git?

like image 467
Asker Avatar asked Feb 02 '26 01:02

Asker


1 Answers

Nevermind, that same section of the tutorial has the answer. This is embarrassing!

Basically, CMake lets you substitute your version number into your code at build-time (essentially a macro), which git doesn't.

like image 149
Asker Avatar answered Feb 04 '26 14:02

Asker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!