From 568e5ea5468e0798a1ed156638267b87d43a3e44 Mon Sep 17 00:00:00 2001 From: Winfried Dobbe Date: Wed, 8 Apr 2020 16:02:33 +0200 Subject: [PATCH] Simplify version information using the cmake project() command --- CMakeLists.txt | 30 ++++++++---------------------- cmake-config.h.in | 6 +++--- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cea07f806..0a15a5ddb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -cmake_minimum_required(VERSION 3.10) +# ============= +# CMake init +# ============= +cmake_minimum_required(VERSION 3.12) # ==================== # Version informations @@ -22,38 +25,22 @@ cmake_minimum_required(VERSION 3.10) # Stable versions: x.y.z , where z < 50 # Development versions: x.y.90 # Pre-release versions: x.y.z, where z = 90 + X in rcX (1.1rc1 = 1.1.91) -set(icecream_version_major "1") -set(icecream_version_minor "3") -set(icecream_version_micro "90") - -if(${icecream_version_micro} STREQUAL "") -set(icecream_version "${icecream_version_major}.${icecream_version_minor}") -else() -set(icecream_version "${icecream_version_major}.${icecream_version_minor}.${icecream_version_micro}") -endif() +project(icecc VERSION 1.3.90 LANGUAGES CXX C) set(PACKAGE "icecc") -set(VERSION "${icecream_version}") set(PACKAGE_BUGREPORT "") set(TARNAME "") set(PACKAGE_URL "") set(PACKAGE_NAME "${PACKAGE}") -set(PACKAGE_VERSION "${VERSION}") -if(VERSION) - set(PACKAGE_STRING "${PACKAGE} ${VERSION}") -else() - set(PACKAGE_STRING "${PACKAGE}") -endif() +set(PACKAGE_VERSION "${icecc_VERSION}") #get rid of this one later +set(PACKAGE_STRING "${PACKAGE} ${icecc_VERSION}") + if(NOT TARNAME) string(REGEX REPLACE "[^a-zA-Z0-9_]" "-" TARNAME "${PACKAGE}") endif() set(PACKAGE_TARNAME "${TARNAME}") -# ============= -# CMake init -# ============= -project(icecc LANGUAGES CXX C) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules @@ -115,7 +102,6 @@ endif() # =========================== # Find required base packages # =========================== -find_package(Libcap-ng) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") find_package(Libcap-ng) if (Libcap-ng_FOUND) diff --git a/cmake-config.h.in b/cmake-config.h.in index be9156b6e..3bb4325e8 100644 --- a/cmake-config.h.in +++ b/cmake-config.h.in @@ -161,7 +161,7 @@ #define PACKAGE_URL "@PACKAGE_URL@" /* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" +#define PACKAGE_VERSION "@icecc_VERSION@" /* Where to place pid files */ #cmakedefine RUNDIR "@RUNDIR@" @@ -173,7 +173,7 @@ #cmakedefine STDC_HEADERS @STDC_HEADERS@ /* Version number of package */ -#define VERSION "@VERSION@" +#define VERSION "@icecc_VERSION@" /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ @@ -181,4 +181,4 @@ #cmakedefine inline @inline@ #endif -#define TAR "@TAR_PROGRAM@" \ No newline at end of file +#define TAR "@TAR_PROGRAM@"