aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-09-12 13:06:51 +0200
committerRiccardo Spagni <ric@spagni.net>2014-09-12 13:12:43 +0200
commit8334ce0b2435e925efd54a6efc6f97478792b55c (patch)
tree6e8c9e684e67dc0e840df991bde4640c3f76f87b /CMakeLists.txt
parentalways check git diff (diff)
downloadmonero-8334ce0b2435e925efd54a6efc6f97478792b55c.tar.xz
versioning now includes the commit hash, or -final for tagged releases
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt26
1 files changed, 7 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 237181253..b80712737 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,9 +30,6 @@
cmake_minimum_required(VERSION 2.8.6)
-set(VERSION "0.1")
-# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$
-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
enable_testing()
@@ -161,24 +158,15 @@ elseif(NOT MSVC)
endif()
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
-if(DEFINED COMMIT)
- string(REPLACE "." "\\." VERSION_RE "${VERSION}")
- if(NOT REFS MATCHES "(\\(|, )tag: v${VERSION_RE}(\\)|, )")
- set(VERSION "${VERSION}-g${COMMIT}")
- endif()
+find_package(Git QUIET)
+if(Git_FOUND OR GIT_FOUND)
+ message(STATUS "Found Git: ${GIT_EXECUTABLE}")
+ add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
+else()
+ message(STATUS "WARNING: Git was not found!")
+ set(VERSIONTAG "unknown")
configure_file("src/version.h.in" "version/version.h")
add_custom_target(version ALL)
-else()
- find_package(Git QUIET)
- if(Git_FOUND OR GIT_FOUND)
- message(STATUS "Found Git: ${GIT_EXECUTABLE}")
- add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "VERSION=${VERSION}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
- else()
- message(STATUS "WARNING: Git was not found!")
- set(VERSION "${VERSION}-unknown")
- configure_file("src/version.h.in" "version/version.h")
- add_custom_target(version ALL)
- endif()
endif()
add_subdirectory(external)