From b69e7cd03459c04e7e3dee1daa38a73c9ad84373 Mon Sep 17 00:00:00 2001 From: Karim ElDeeb Date: Sun, 20 May 2018 14:54:24 +0200 Subject: [PATCH] Add build version to the nightly builds (#1390) Make the Windows nightly build versioning information meaningful. ;) --- CMakeLists.txt | 13 ++++++++++++- src/version.h | 6 ++++++ src/winapp.rc | 4 ++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a306ad95..485e09c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,16 @@ project(sqlitebrowser) -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.11) + +# BUILD_VERSION is the current date in YYYYMMDD format. It is only +# used by the nightly version to add the date of the build. +string(TIMESTAMP BUILD_VERSION "%Y%m%d") + +# Choose between building a stable version or nightly (the default), depending +# on whether '-DBUILD_STABLE_VERSION=1' is passed on the command line or not. +option(BUILD_STABLE_VERSION "Don't build the stable version by default" OFF) +if(NOT BUILD_STABLE_VERSION) + add_definitions(-DBUILD_VERSION=${BUILD_VERSION}) +endif() set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") diff --git a/src/version.h b/src/version.h index ead16230..9e110e06 100644 --- a/src/version.h +++ b/src/version.h @@ -7,4 +7,10 @@ #define str(s) #s #define xstr(s) str(s) #define APP_VERSION xstr(MAJOR_VERSION) "." xstr(MINOR_VERSION) "." xstr(PATCH_VERSION) + +// If it is defined by the compiler, then it is a nightly build, and in the YYYYMMDD format. +#ifndef BUILD_VERSION + #define BUILD_VERSION 0 +#endif + #endif diff --git a/src/winapp.rc b/src/winapp.rc index 07c21715..2acbe5db 100644 --- a/src/winapp.rc +++ b/src/winapp.rc @@ -11,8 +11,8 @@ BEGIN BEGIN BLOCK "000004B0" BEGIN - VALUE "FileVersion", APP_VERSION - VALUE "ProductVersion", APP_VERSION + VALUE "FileVersion", APP_VERSION "." xstr(BUILD_VERSION) + VALUE "ProductVersion", APP_VERSION "." xstr(BUILD_VERSION) VALUE "FileDescription", "DB Browser for SQLite" VALUE "ProductName", "DB Browser for SQLite" VALUE "InternalName", "DB Browser for SQLite"