diff --git a/configure.json b/configure.json
index ad9fd117cfe0e80a25e47770c9b5b326ff785a77..62b56bbb1ab5a63087a6271c3960a5453fcaf900 100644
--- a/configure.json
+++ b/configure.json
@@ -10,6 +10,7 @@
         "options": {
             "alsa": "boolean",
             "embedded": "boolean",
+            "optimize-for-size": { "type": "boolean", "name": "optimize_size" },
             "ffmpeg": { "type": "enum", "name": "system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
             "opus": { "type": "enum", "name": "system-opus", "values": { "system": "yes", "qt": "no" } },
             "webp": { "type": "enum", "name": "system-webp", "values": { "system": "yes", "qt": "no" } },
@@ -79,6 +80,11 @@
             "purpose": "Enables the embedded build configuration",
             "output": [ "privateFeature" ]
         },
+        "optimize_size": {
+            "label": "Optimize for size",
+            "autoDetect": "tests.embedded",
+            "output": [ "privateFeature" ]
+        },
         "alsa": {
             "label": "ALSA",
             "condition": "config.unix && libs.alsa",
@@ -156,6 +162,7 @@
             "section": "Qt WebEngine",
             "entries": [
                 "embedded",
+                "optimize_size",
                 "pepper-plugins",
                 "printing-and-pdf",
                 "proprietary-codecs",
diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf
index 768b86a309f6fb4ec8e4e45108b61960860e1b49..86665274f3df60d678ba60dc3abcb718e0776372 100644
--- a/tools/qmake/mkspecs/features/configure.prf
+++ b/tools/qmake/mkspecs/features/configure.prf
@@ -30,6 +30,7 @@ defineTest(runConfigure) {
         qtConfig(spellchecker): WEBENGINE_CONFIG += use_spellchecker
         qtConfig(webrtc): WEBENGINE_CONFIG += use_webrtc
         qtConfig(embedded): WEBENGINE_CONFIG += embedded_build
+        qtConfig(optimize_size): WEBENGINE_CONFIG += reduce_binary_size
         qtConfig(system-webp): WEBENGINE_CONFIG += use_system_libwebp
         else: WEBENGINE_CONFIG += use_bundled_libwebp
         qtConfig(system-opus): WEBENGINE_CONFIG += use_system_opus
@@ -37,7 +38,7 @@ defineTest(runConfigure) {
         qtConfig(system-ffmpeg): WEBENGINE_CONFIG += use_system_ffmpeg
         else: WEBENGINE_CONFIG += use_bundled_ffmpeg
     } else {
-        cross_compile: WEBENGINE_CONFIG += embedded_build
+        cross_compile: WEBENGINE_CONFIG += embedded_build reduce_binary_size
     }
     isQtMinimum(5, 9) {
         qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code
@@ -105,8 +106,6 @@ defineTest(runConfigure) {
         !contains(WEBENGINE_CONFIG, embedded_build) {
             packagesExist(nss): WEBENGINE_CONFIG += use_nss
             else: log("System NSS not found, BoringSSL will be used.$${EOL}")
-        } else {
-            WEBENGINE_CONFIG *= reduce_binary_size
         }
     }