diff --git a/lib/bb/main.py b/lib/bb/main.py
index 73a66468fef..7c65dfff1af 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -256,6 +256,9 @@ def create_bitbake_parser():
                         help="Output less log message data to the terminal. You can specify this "
                              "more than once.")
 
+    logging_group.add_argument("-W", "--warnings-as-errors", action="store_true", dest="werror",
+                        help="Treat warnings as errors.")
+
     logging_group.add_argument("-w", "--write-log", dest="writeeventlog",
                         default=os.environ.get("BBEVENTLOG"),
                         help="Writes the event log of the build to a bitbake event json file. "
