Repro (on Linux):
./build.sh -DBUILD_UNIT_TESTS=NO -DBUILD_FUNC_TESTS=NO noroot
The result is that the build script parses noroot, then executes a shift commands which causes the first argument (-DBUILD_UNIT_TESTS=NO) to not be evaluated by getopt
Positional arguments should probably only be valid if they precede the switches, and any arguments trailing the switches should probably result in an error.