Skip to content

Commit f4ddca5

Browse files
nordicjmcarlescufi
authored andcommitted
sysbuild: Check for duplicate image names
Checks if the IMAGES variable has been updated with a duplicate image name, which would otherwise cause an infinite loop. Signed-off-by: Jamie McCrae <[email protected]> Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent b71b514 commit f4ddca5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

share/sysbuild/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021 Nordic Semiconductor
1+
# Copyright (c) 2021-2023 Nordic Semiconductor
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -80,8 +80,15 @@ while(NOT "${images_length}" EQUAL "${processed_length}")
8080
endif()
8181
endforeach()
8282
83-
list(LENGTH images_sysbuild_processed processed_length)
8483
list(LENGTH IMAGES images_length)
84+
list(LENGTH images_sysbuild_processed processed_length_new)
85+
86+
# Check for any duplicate entries in image names to prevent an infinite loop
87+
if("${processed_length_new}" EQUAL "${processed_length}")
88+
# Image length was different than processed length, but no new images are processed.
89+
message(FATAL_ERROR "A duplicate image name was provided, image names must be unique.")
90+
endif()
91+
set(processed_length ${processed_length_new})
8592
endwhile()
8693
8794
include(cmake/domains.cmake)

0 commit comments

Comments
 (0)