From 20aa4c94e7785789940508ac24399e8d2ef07efa Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 19 Aug 2025 11:32:05 +0200 Subject: [PATCH] feat(cmakev2/utilities): add add_prefix function The add_prefix function is used by some existing components, so it should be added to cmakev2 as well. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/utilities.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/cmakev2/utilities.cmake b/tools/cmakev2/utilities.cmake index 6a49200145d..6c5e65fb047 100644 --- a/tools/cmakev2/utilities.cmake +++ b/tools/cmakev2/utilities.cmake @@ -519,3 +519,19 @@ function(spaces2list variable_name) string(REPLACE " " ";" tmp "${${variable_name}}") set("${variable_name}" "${tmp}" PARENT_SCOPE) endfunction() + +#[[ + add_prefix( ...) + + :variable[out]: Output variable with list of prefixed items. + :prefix[in]: Prefix string. + :item[in]: Items to be prefixed. + + Add a prefix to each item in the given list. +#]] +function(add_prefix var prefix) + foreach(elm ${ARGN}) + list(APPEND newlist "${prefix}${elm}") + endforeach() + set(${var} "${newlist}" PARENT_SCOPE) +endfunction()