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:06:51 +0200
commit14b3b6ea02ab5a228a2551bc8be7212ec7c15f37 (patch)
tree25bdf5988b19ded9df97555d9b8a808c1ad7acb9 /CMakeLists.txt
parentalways check git diff (diff)
downloadmonero-14b3b6ea02ab5a228a2551bc8be7212ec7c15f37.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)