cmake: Add `--parallel` build option

This commit is contained in:
Daniel Teunis 2019-10-07 00:25:06 +02:00
parent 922eee0706
commit 4b5da4cbe0
1 changed files with 5 additions and 0 deletions

View File

@ -132,6 +132,7 @@ _cmake_on_build() {
'--target[specify build target]' '--target[specify build target]'
'--clean-first[build target clean first]' '--clean-first[build target clean first]'
'--config[For multi-configuration tools]' '--config[For multi-configuration tools]'
'--parallel[maximum number of build processes]'
'--use-stderr') '--use-stderr')
local -a undescribed_build_extras local -a undescribed_build_extras
i=1 i=1
@ -157,6 +158,7 @@ _cmake_on_build() {
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --target ]] ; then continue ; fi if [[ $words[(($i - 1))] == --target ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --parallel ]] ; then continue ; fi
outofbuild=true outofbuild=true
done done
if (( $dashdashposition > 0 )) ; then if (( $dashdashposition > 0 )) ; then
@ -175,6 +177,9 @@ _cmake_on_build() {
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
# after --build <dir> --config, no idea # after --build <dir> --config, no idea
return 0 return 0
elif [[ $words[(($CURRENT - 1))] == --parallel ]] ; then
# after --build <dir> --parallel
return 0
elif [ "$outofbuild" = true ] ; then elif [ "$outofbuild" = true ] ; then
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev) # after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
_arguments "$cmake_build_options[@]" && return 0 _arguments "$cmake_build_options[@]" && return 0