Skip to content

Commit

Permalink
Set VERSION in 'project'
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Nov 21, 2015
1 parent 1f8938e commit 5b55c72
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
cmake_minimum_required(VERSION 2.8)
project(Foo)

add_library(foo foo.cpp)
add_executable(boo foo.cpp)

install(TARGETS foo DESTINATION lib)
install(TARGETS boo DESTINATION bin)
cmake_minimum_required(VERSION 3.0)

string(COMPARE NOTEQUAL "$ENV{TRAVIS_TAG}" "" travis_deploy)
string(COMPARE EQUAL "$ENV{APPVEYOR_REPO_TAG}" "true" appveyor_deploy)
Expand All @@ -18,13 +11,17 @@ else()
set(version "v0.0.0")
endif()

string(REGEX REPLACE "^v([0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" x "${version}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+)\\.[0-9]+$" "\\1" y "${version}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+)$" "\\1" z "${version}")
string(REGEX REPLACE "^v" "" version "${version}")

project(Foo VERSION ${version})

add_library(foo foo.cpp)
add_executable(boo foo.cpp)

install(TARGETS foo DESTINATION lib)
install(TARGETS boo DESTINATION bin)

set(CPACK_PACKAGE_VERSION_MAJOR ${x})
set(CPACK_PACKAGE_VERSION_MINOR ${y})
set(CPACK_PACKAGE_VERSION_PATCH ${z})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})

if(travis_deploy OR appveyor_deploy)
string(COMPARE EQUAL "$ENV{CONFIG}" "Debug" debug_build)
Expand Down

0 comments on commit 5b55c72

Please sign in to comment.