From 8556877dfdf9ae458f34f0d3f0cc482e0f9cd9cc Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Thu, 7 Feb 2019 21:48:42 +0100 Subject: [PATCH] cmake: fix tag extraction, again --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4a9644028..ee68e6156a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,12 +63,14 @@ set(dronecode_sdk_install_include_dir "include/dronecode_sdk") set(dronecode_sdk_install_lib_dir ${lib_path}) execute_process( - COMMAND git describe --abbrev=8 --dirty --always --tags | sed 's/v\\([0-9]*\\.[0-9]*\\.[0-9]*.*$\\)/\\1/' + COMMAND git describe --abbrev=8 --dirty --always --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE VERSION_STR OUTPUT_STRIP_TRAILING_WHITESPACE ) +STRING(REGEX REPLACE v\([0-9]+.[0-9]+.[0-9]+.*$\) \\1 VERSION_STR ${VERSION_STR}) + message(STATUS "Version: ${VERSION_STR}") add_definitions(-DDRONECODE_SDK_VERSION="${VERSION_STR}")