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.
This commit is contained in:
Pietro Albini 2024-08-21 13:43:28 +02:00 committed by Xiang Xiao
parent a60185cc40
commit c19cbdf8d6
1 changed files with 2 additions and 1 deletions

View File

@ -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")