diff --git a/build/gyp_qtwebengine b/build/gyp_qtwebengine
index b67314df295fe92f1c40ff84c1b75c6b5e69d548..bd7347e4a4c262faa36e9c6680443f5b795a3b9f 100755
--- a/build/gyp_qtwebengine
+++ b/build/gyp_qtwebengine
@@ -65,6 +65,9 @@ def additional_include_files(args=[]):
   # Used for additional build tweaks such as file exclusions
   AddInclude(os.path.join(qtwebengine_src, 'build', 'qtwebengine_extras.gypi'))
 
+  # Common stuff we generate and extract from qmake
+  AddInclude(os.path.join(qtwebengine_src, 'build', 'qmake_extras.gypi'))
+
   # Optionally add supplemental .gypi files if present.
   supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
   for supplement in supplements:
diff --git a/build/qmake_extras/host/host.pro b/build/qmake_extras/host/host.pro
new file mode 100644
index 0000000000000000000000000000000000000000..95d7b3cad7ddb182a019e9cad02b86835f4eefdf
--- /dev/null
+++ b/build/qmake_extras/host/host.pro
@@ -0,0 +1,14 @@
+# Prevent generating a makefile that attempts to create a lib
+TEMPLATE = aux
+
+# Pick up the host toolchain
+option(host_build)
+
+GYPI_CONTENTS = "{" \
+                "  'make_global_settings': [" \
+                "    ['CC.host', '$$which($$QMAKE_CC)']," \
+                "    ['CXX.host', '$$which($$QMAKE_CXX)']," \
+                "    ['LD.host', '$$which($$QMAKE_LINK)'],"
+
+GYPI_FILE = $$absolute_path('build/qmake_extras.gypi', $$QTWEBENGINE_ROOT)
+write_file($$GYPI_FILE, GYPI_CONTENTS)
diff --git a/build/qmake_extras/qmake_extras.pro b/build/qmake_extras/qmake_extras.pro
new file mode 100644
index 0000000000000000000000000000000000000000..409993128caa7e5739b9228becfae94785d8218d
--- /dev/null
+++ b/build/qmake_extras/qmake_extras.pro
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+
+CONFIG += ordered
+
+SUBDIRS = host \
+          target
diff --git a/build/qmake_extras/target/target.pro b/build/qmake_extras/target/target.pro
new file mode 100644
index 0000000000000000000000000000000000000000..294ebc6091fc4158ab9ffd24cab3f54dbe92c47d
--- /dev/null
+++ b/build/qmake_extras/target/target.pro
@@ -0,0 +1,15 @@
+# Prevent generating a makefile that attempts to create a lib
+TEMPLATE = aux
+
+GYPI_CONTENTS += "    ['CC', '$$which($$QMAKE_CC)']," \
+                 "    ['CXX', '$$which($$QMAKE_CXX)']," \
+                 "    ['LD', '$$which($$QMAKE_LINK)'],"
+GYPI_CONTENTS += "  ],"
+GYPI_CONTENTS += "}"
+
+GYPI_FILE = $$absolute_path('build/qmake_extras.gypi', $$QTWEBENGINE_ROOT)
+
+!exists($$GYPI_FILE): error("-- $$GYPI not found --")
+
+# Append to the file already containing the host settings.
+write_file($$GYPI_FILE, GYPI_CONTENTS, append)
diff --git a/qtwebengine.pro b/qtwebengine.pro
index ce0098c55ae49e8905d793f0e54b94ba2a361650..5a54df17ee9201450eb80c7cc277a899cca1562b 100644
--- a/qtwebengine.pro
+++ b/qtwebengine.pro
@@ -4,7 +4,8 @@ CONFIG += ordered
 
 # The first three subdirs contain dummy .pro files that are used by qmake
 # to generate a corresponding .gyp file
-SUBDIRS = resources \
+SUBDIRS = build/qmake_extras \ # Phony pro file that extracts things like compiler and linker from qmake
+          resources \
           shared \
           lib \
           process \