Skip to content

CMake: Determine Version in Chechout with --notags

Simon Spannagel requested to merge p-cmake-notags into master

...otherwise determining a version in case of git fetch --notags && git checkout will fail with:

cmake ..

-- Git project directory is clean.
-- Building Allpix^2 version fatal: No names found, cannot describe anything..
-- Building "RelWithDebInfo"
CMake Error at CMakeLists.txt:43 (PROJECT):
  VERSION "." format invalid.

-- Configuring incomplete, errors occurred!

Now instead CMake reports:

cmake ..

-- Git repository present, but could not find any tags.
-- Building Allpix^2 version v2.0.0-unknown.
-- Building "RelWithDebInfo"

...with the latest project version from the CMakeLists.txt file.

Merge request reports