Created
November 21, 2015 20:30
-
-
Save vosst/453d0867fe2ffde3933e to your computer and use it in GitHub Desktop.
Snippet to set a sensible fallback value for major.minor.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We haven't received version information via the packaging setup. | |
# For that, we try to determine sensible values on our own, ensuring | |
# plain old invocations to cmake still work as expected. | |
if (NOT DEFINED TRUST_STORE_VERSION_MAJOR) | |
find_program(LSB_RELEASE lsb_release) | |
execute_process( | |
COMMAND ${LSB_RELEASE} -c -s | |
OUTPUT_VARIABLE DISTRO_CODENAME | |
OUTPUT_STRIP_TRAILING_WHITESPACE) | |
# We explicitly ignore errors and only check if we are building for vivid. | |
# For all other cases: | |
# - releases other than vivid | |
# - other distros | |
# - errors | |
# we define the version to be 2.0.0 | |
if (${DISTRO_CODENAME} STREQUAL "vivid") | |
set(TRUST_STORE_VERSION_MAJOR 1) | |
set(TRUST_STORE_VERSION_MINOR 1) | |
set(TRUST_STORE_VERSION_PATCH 0) | |
else () | |
set(TRUST_STORE_VERSION_MAJOR 2) | |
set(TRUST_STORE_VERSION_MINOR 0) | |
set(TRUST_STORE_VERSION_PATCH 0) | |
endif() | |
endif() | |
message(STATUS "${CMAKE_PROJECT_NAME} ${TRUST_STORE_VERSION_MAJOR}.${TRUST_STORE_VERSION_MINOR}.${TRUST_STORE_VERSION_PATCH}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment