diff --git a/examples/wayland/server-buffer/client/client.pro b/examples/wayland/server-buffer/client/client.pro
index ce4a04f919db75e6e70bda545474ecb7c45f3d9c..9d408d9e93a2d95c282bcba47f693785828a1622 100644
--- a/examples/wayland/server-buffer/client/client.pro
+++ b/examples/wayland/server-buffer/client/client.pro
@@ -3,8 +3,13 @@ TARGET = client
 INCLUDEPATH += .
 
 QT += waylandclient-private
-CONFIG += link_pkgconfig
-PKGCONFIG += wayland-client
+
+!contains(QT_CONFIG, no-pkg-config) {
+    PKGCONFIG += wayland-client
+    CONFIG += link_pkgconfig
+} else {
+    LIBS += -lwayland-client
+}
 
 CONFIG += wayland-scanner
 WAYLANDCLIENTSOURCES += ../share-buffer.xml
diff --git a/examples/wayland/server-buffer/compositor/compositor.pro b/examples/wayland/server-buffer/compositor/compositor.pro
index 9f7751a09737a34f265db7cbc8b129aff258be25..8d7f488209121cf96a61204c4a3473f2be087cec 100644
--- a/examples/wayland/server-buffer/compositor/compositor.pro
+++ b/examples/wayland/server-buffer/compositor/compositor.pro
@@ -17,7 +17,4 @@ RESOURCES += compositor.qrc
 CONFIG +=wayland-scanner
 WAYLANDSERVERSOURCES += ../share-buffer.xml
 
-CONFIG += link_pkgconfig
-PKGCONFIG += wayland-server
-
 DEFINES += QT_COMPOSITOR_QUICK