Skip to content

Commit a1e2c67

Browse files
committed
[nrf noup] version: Fix TFM_VERSION being undefined
nrf-squash! [nrf noup] build: fix TF-M version Fixes an issue where the TFM_VERSION was not set because the return() statement exited early. This removes all the logic from the unused logic from the version.cmake since it is irrelevant. Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent 3533b12 commit a1e2c67

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

cmake/version.cmake

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,5 @@
88
# The 'TFM_VERSION_MANUAL' is used for fallback when Git tags are not available
99
set(TFM_VERSION_MANUAL "2.2.0")
1010

11-
if(TRUE)
12-
# Git execution fails.
13-
# Applying a manual version assuming the code tree is a local copy.
14-
set(TFM_VERSION_FULL "v${TFM_VERSION_MANUAL}")
15-
return()
16-
endif()
17-
18-
# In a repository cloned with --no-tags option TFM_VERSION_FULL will be a hash
19-
# only hence checking it for a tag format to accept as valid version.
20-
21-
string(FIND "${TFM_VERSION_FULL}" "TF-M" TFM_TAG)
22-
if(TFM_TAG EQUAL -1)
23-
execute_process(COMMAND git log --format=format:%h -n 1
24-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
25-
OUTPUT_VARIABLE TFM_GIT_HASH
26-
OUTPUT_STRIP_TRAILING_WHITESPACE)
27-
28-
set(TFM_VERSION_FULL "v${TFM_VERSION_MANUAL}+g${TFM_GIT_HASH}")
29-
endif()
30-
31-
string(REGEX REPLACE "TF-M" "" TFM_VERSION_FULL ${TFM_VERSION_FULL})
32-
# remove a commit number
33-
string(REGEX REPLACE "-[0-9]+-g" "+" TFM_VERSION_FULL ${TFM_VERSION_FULL})
34-
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" TFM_VERSION ${TFM_VERSION_FULL})
35-
36-
# Check that manually set version is up to date
37-
if (NOT TFM_VERSION_MANUAL STREQUAL TFM_VERSION)
38-
message(WARNING "TFM_VERSION_MANUAL mismatches to actual TF-M version. Please update TFM_VERSION_MANUAL in cmake/version.cmake")
39-
endif()
11+
set(TFM_VERSION_FULL "v${TFM_VERSION_MANUAL}")
12+
set(TFM_VERSION "${TFM_VERSION_MANUAL}")

0 commit comments

Comments
 (0)