From 74cc79d7a2d8b1820d8cfad40065c38463b16a94 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Thu, 13 Oct 2022 04:09:04 +0800 Subject: [PATCH] [cmake-build] allow specify multiple targets (#8264) This commit allows using OT_CMAKE_NINJA_TARGET to specify multiple targets. --- script/cmake-build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script/cmake-build b/script/cmake-build index b7c6d3ed5..aca71139e 100755 --- a/script/cmake-build +++ b/script/cmake-build @@ -45,6 +45,7 @@ # Compile with the specified ninja build target: # # OT_CMAKE_NINJA_TARGET="ot-cli-ftd" script/cmake-build ${platform} +# OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" script/cmake-build ${platform} # # Compile with the specified build directory: # @@ -122,11 +123,11 @@ build() cd "${builddir}" cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DOT_COMPILE_WARNING_AS_ERROR=ON "$@" "${OT_SRCDIR}" - - if [[ -n ${OT_CMAKE_NINJA_TARGET[*]} ]]; then - ninja "${OT_CMAKE_NINJA_TARGET[@]}" - else + if [[ -z ${OT_CMAKE_NINJA_TARGET// /} ]]; then ninja + else + IFS=' ' read -r -a OT_CMAKE_NINJA_TARGET <<<"${OT_CMAKE_NINJA_TARGET}" + ninja "${OT_CMAKE_NINJA_TARGET[@]}" fi cd "${OT_SRCDIR}"