Is there a way to get product version when building the project via cmake from terminal. In the CMakeLists.txt I have declared:
project(sayProject VERSION "1.0")
Appreciate any help.
If you want to read the setting of PROJECT_VERSION without actually running cmake, then this answer will get you that.
Specifically, I use this script:
cmake --system-information |
  awk -F= '$1~/CMAKE_PROJECT_VERSION:STATIC/{print$2}'
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