From 175cc28b9716f7f4f10eeee53fc541e556abe22e Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Fri, 15 Nov 2013 18:15:14 +0100
Subject: [PATCH] Remove the need for application to set an RPATH.

The WebEngineWidgets module and the WebEngine QtQuick plugin libraries
already have the RPATH set properly in their headers and the application
won't need to link any symbol directly to the Core library.

Remove the RPATH directive for examples and tests and fix the build issue
by making sure that the link directive isn't passed to dependencies
through the prl or pkgconfig file.

Change-Id: Id1f5efb8c9823613e804e8e6356d711d561d72ec
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 common.pri                                                | 8 --------
 examples/quick/quicknanobrowser/quicknanobrowser.pro      | 2 +-
 examples/widgets/browser/browser.pro                      | 2 +-
 examples/widgets/fancybrowser/fancybrowser.pro            | 2 +-
 .../widgets/widgetsnanobrowser/widgetsnanobrowser.pro     | 2 +-
 lib/quick/quick.pro                                       | 2 +-
 lib/widgets/widgets.pro                                   | 2 +-
 tests/auto/quick/tests.pri                                | 2 +-
 tests/auto/widgets/tests.pri                              | 2 +-
 9 files changed, 8 insertions(+), 16 deletions(-)
 delete mode 100644 common.pri

diff --git a/common.pri b/common.pri
deleted file mode 100644
index 5f4dbc3bc..000000000
--- a/common.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-macx:LIBPATH = $$getOutDir()/$$getConfigDir()
-else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
-
-macx: CONFIG -= app_bundle
-
-# Allows examples/tests to link to libQt5WebEngineCore which
-# isn't deployed properly yet.
-QMAKE_RPATHDIR += $$LIBPATH
diff --git a/examples/quick/quicknanobrowser/quicknanobrowser.pro b/examples/quick/quicknanobrowser/quicknanobrowser.pro
index 2132b031a..aae724c55 100644
--- a/examples/quick/quicknanobrowser/quicknanobrowser.pro
+++ b/examples/quick/quicknanobrowser/quicknanobrowser.pro
@@ -1,7 +1,7 @@
 TEMPLATE = app
 TARGET = quicknanobrowser
 
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 HEADERS = quickwindow.h
 SOURCES = quickwindow.cpp main.cpp
diff --git a/examples/widgets/browser/browser.pro b/examples/widgets/browser/browser.pro
index e19efafb1..c63602412 100644
--- a/examples/widgets/browser/browser.pro
+++ b/examples/widgets/browser/browser.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
 TARGET = browser
 QT += webenginewidgets network widgets printsupport
 
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 qtHaveModule(uitools):!embedded: QT += uitools
 else: DEFINES += QT_NO_UITOOLS
diff --git a/examples/widgets/fancybrowser/fancybrowser.pro b/examples/widgets/fancybrowser/fancybrowser.pro
index 01f7c535a..eb5e5a34c 100644
--- a/examples/widgets/fancybrowser/fancybrowser.pro
+++ b/examples/widgets/fancybrowser/fancybrowser.pro
@@ -1,6 +1,6 @@
 QT      +=  webenginewidgets
 
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 HEADERS =   mainwindow.h
 SOURCES =   main.cpp \
diff --git a/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro b/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
index bd9e53a90..c79d314c2 100644
--- a/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
+++ b/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
@@ -1,7 +1,7 @@
 TEMPLATE = app
 TARGET = widgetsnanobrowser
 
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 HEADERS = widgetwindow.h
 SOURCES = widgetwindow.cpp main.cpp
diff --git a/lib/quick/quick.pro b/lib/quick/quick.pro
index 78650dedc..c4c248a41 100644
--- a/lib/quick/quick.pro
+++ b/lib/quick/quick.pro
@@ -14,7 +14,7 @@ INCLUDEPATH += ../
 # FIXME: all this should eventually be turned into QT += webenginecore
 macx:LIBPATH = $$getOutDir()/$$getConfigDir()
 else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
-LIBS += -lQt5WebEngineCore -L$$LIBPATH
+LIBS_PRIVATE += -lQt5WebEngineCore -L$$LIBPATH
 QMAKE_RPATHDIR += $$LIBPATH
 
 #DESTDIR = $$LIBPATH
diff --git a/lib/widgets/widgets.pro b/lib/widgets/widgets.pro
index 60730f880..5da1be091 100644
--- a/lib/widgets/widgets.pro
+++ b/lib/widgets/widgets.pro
@@ -17,7 +17,7 @@ QT_PRIVATE += widgets-private gui-private core-private
 # FIXME: all this should eventually be turned into QT += webenginecore
 macx:LIBPATH = $$getOutDir()/$$getConfigDir()
 else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
-LIBS += -L$$LIBPATH -lQt5WebEngineCore
+LIBS_PRIVATE += -lQt5WebEngineCore -L$$LIBPATH
 QMAKE_RPATHDIR += $$LIBPATH
 
 DESTDIR = $$LIBPATH
diff --git a/tests/auto/quick/tests.pri b/tests/auto/quick/tests.pri
index 618ffe0cd..bdefa9159 100644
--- a/tests/auto/quick/tests.pri
+++ b/tests/auto/quick/tests.pri
@@ -12,7 +12,7 @@ INCLUDEPATH += \
 QT += testlib network quick
 QT_PRIVATE += quick-private gui-private core-private
 
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 # This define is used by some tests to look up resources in the source tree
 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/widgets/tests.pri b/tests/auto/widgets/tests.pri
index 3d3979986..4ca22969f 100644
--- a/tests/auto/widgets/tests.pri
+++ b/tests/auto/widgets/tests.pri
@@ -18,7 +18,7 @@ INCLUDEPATH += \
     $$PWD/../Api
 
 QT += testlib network webenginewidgets widgets
-include($$QTWEBENGINE_ROOT/common.pri)
+macx: CONFIG -= app_bundle
 
 # This define is used by some tests to look up resources in the source tree
 DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
-- 
GitLab