xbps-src: new vopt_onoff helper
CMake helper function used to set bool argument values Usage example: configure_args+=" $(vopt_onoff logging WITH_LOGGING)" configure_args+=" -DWITH_LOGGING=OFF"
This commit is contained in:
parent
d64bf2f920
commit
d5c58a3c60
2 changed files with 15 additions and 0 deletions
|
@ -28,3 +28,13 @@ vopt_conflict() {
|
|||
msg_error "options '${opt1}' and '${opt2}' conflict\n"
|
||||
fi
|
||||
}
|
||||
|
||||
vopt_onoff() {
|
||||
local opt="$1" prop="$2"
|
||||
if [ "$#" -lt "2" ]; then
|
||||
msg_error "vopt_onoff <build_option> <property>: missing values\n"
|
||||
elif [ "$#" -gt "2" ]; then
|
||||
msg_error "vopt_onoff $opt: $(($# - 2)) excess parameter(s)\n"
|
||||
fi
|
||||
vopt_if "$1" "-D${prop}=ON" "-D${prop}=OFF"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue