diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 26 |
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) |