From c19cbdf8d6b5002bcf33827f54b2bc64742c5649 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 21 Aug 2024 13:43:28 +0200 Subject: [PATCH] cmake: fix invalid syntax when generating version.h from tags When building from git tags, the version number in `include/version.h` is extracted from the output of `git describe`. While that is correct, cmake was not configured to strip trailing whitespace from the command output, which resulted in the version number being `12.5.1\n`. That broke the generation of `include/version.h`, as the `\n` resulted in the terminating quote being in a new line. This commit fixes that by instructing cmake to strip trailing whitespace. --- cmake/nuttx_mkversion.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx_mkversion.cmake b/cmake/nuttx_mkversion.cmake index 7185fdc610..4c5110b952 100644 --- a/cmake/nuttx_mkversion.cmake +++ b/cmake/nuttx_mkversion.cmake @@ -28,7 +28,8 @@ execute_process( WORKING_DIRECTORY ${NUTTX_DIR} ERROR_VARIABLE NUTTX_ERROR OUTPUT_VARIABLE NUTTX_VERSION - RESULT_VARIABLE VERSION_STATUS) + RESULT_VARIABLE VERSION_STATUS + OUTPUT_STRIP_TRAILING_WHITESPACE) if(${VERSION_STATUS} AND NOT ${VERSION_STATUS} EQUAL 0) set(NUTTX_VERSION "0.0.0")