From cfd476efb9208c7e6766d24bd32292ce7f812750 Mon Sep 17 00:00:00 2001 From: Florent Vennetier Date: Tue, 12 Jan 2021 15:22:48 +0100 Subject: [PATCH] cmake: allow to set API_VERSION from CLI --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 467241a..c0e7c51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,12 @@ include(CheckIncludeFile) include(CheckLibraryExists) include(CheckTypeSize) +# These variables cannot be set from CLI set(GridInit_VERSION_MAJOR 2) set(GridInit_VERSION_MINOR 2) set(GridInit_RELEASE 0) -set(API_VERSION "${GridInit_VERSION_MAJOR}.${GridInit_VERSION_MINOR}.${GridInit_RELEASE}") -set(SHORT_API_VERSION "${GridInit_VERSION_MAJOR}.${GridInit_VERSION_MINOR}") +# This variable can be set from CLI: cmake -DAPI_VERSION=1.2.3 [...] +set(API_VERSION "${GridInit_VERSION_MAJOR}.${GridInit_VERSION_MINOR}.${GridInit_RELEASE}" CACHE STRING "Gridinit full version number") add_definitions(-DAPI_VERSION="${API_VERSION}") add_definitions(-DSHORT_API_VERSION="${SHORT_API_VERSION}")