From 3f3cd9f9cb659f87433ee30fd1e28daaceb857f2 Mon Sep 17 00:00:00 2001
From: Sam Yates <yates@cscs.ch>
Date: Fri, 12 Oct 2018 13:06:23 +0200
Subject: [PATCH] Bump version post 0.1 for development. (#623)

cf. CMake issue 16716: https://gitlab.kitware.com/cmake/cmake/issues/16716

* Bump version post 0.1 for development.
* Read version string from file VERSION.
* Strip suffix to make a numerical, CMake-compatible PROJECT_VERSION.
---
 CMakeLists.txt         | 7 ++++++-
 VERSION                | 1 +
 include/CMakeLists.txt | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 VERSION

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c2e4f73..ad65682d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,14 @@
 # 3.8 requirement for CUDA language support.
 cmake_minimum_required(VERSION 3.8)
 
-project(arbor VERSION 0.1)
+file(READ VERSION FULL_VERSION_STRING)
+string(STRIP "${FULL_VERSION_STRING}" FULL_VERSION_STRING)
+string(REGEX MATCH "^[0-9]+(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?" numeric_version "${FULL_VERSION_STRING}")
+
+project(arbor VERSION ${numeric_version})
 enable_language(CXX)
 
+
 #----------------------------------------------------------
 # Configure-time build options for Arbor:
 #----------------------------------------------------------
diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000..c9927239
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.1.1-dev
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 815a3b6f..cbc21783 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -46,7 +46,7 @@ endif()
 add_custom_command(
     OUTPUT version.hpp-test
     DEPENDS _always_rebuild
-    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git-source-id ${PROJECT_VERSION} ${arb_features} > version.hpp-test
+    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/git-source-id ${FULL_VERSION_STRING} ${arb_features} > version.hpp-test
 )
 
 set(version_hpp_path arbor/version.hpp)
-- 
GitLab