[cmake-build] allow specify multiple targets (#8264)

This commit allows using OT_CMAKE_NINJA_TARGET to specify multiple
targets.
This commit is contained in:
Yakun Xu
2022-10-12 13:09:04 -07:00
committed by GitHub
parent 3811b6529e
commit 74cc79d7a2
+5 -4
View File
@@ -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}"