diff --git a/README.md b/README.md
index e5381dd..eedf05a 100644
--- a/README.md
+++ b/README.md
@@ -48,11 +48,11 @@ You can now simply run Tiled using bin/tiled.
Installing
-------------------------------------------------------------------------------
-For installing Tiled you can run 'make install'. By default Tiled will install
-to /usr/local. You can change this prefix when running qmake, and/or you can
+For installing Tiled you can run `make install`. By default Tiled will install
+to `/usr/local`. You can change this prefix when running qmake, and/or you can
change the install root when running make install, as follows:
-Use /usr instead of /usr/local:
+Use `/usr` instead of `/usr/local`:
$ qmake -r PREFIX=/usr
@@ -63,3 +63,7 @@ Install to some packaging directory:
$ make install INSTALL_ROOT=/tmp/tiled-pkg
+By default, Tiled and its plugins are compiled with an Rpath so that they can
+find the shared libtiled library when running it straight after compile. When
+packaging for a distribution, this Rpath should generally be disabled by
+appending `RPATH=no` to the qmake command.
diff --git a/src/plugins/plugin.pri b/src/plugins/plugin.pri
index ae1f294..4c0831c 100644
--- a/src/plugins/plugin.pri
+++ b/src/plugins/plugin.pri
@@ -27,7 +27,7 @@ macx {
}
# Set rpath so that the plugin will resolve libtiled correctly
-!win32:!macx {
+!win32:!macx:contains(RPATH, yes) {
QMAKE_RPATHDIR += \$\$ORIGIN/../..
# It is not possible to use ORIGIN in QMAKE_RPATHDIR, so a bit manually
diff --git a/src/tiled/tiled.pro b/src/tiled/tiled.pro
index a47bce0..15905e9 100644
--- a/src/tiled/tiled.pro
+++ b/src/tiled/tiled.pro
@@ -29,7 +29,7 @@ macx {
}
# Make sure the Tiled executable can find libtiled
-!win32:!macx {
+!win32:!macx:contains(RPATH, yes) {
QMAKE_RPATHDIR += \$\$ORIGIN/../lib
# It is not possible to use ORIGIN in QMAKE_RPATHDIR, so a bit manually
diff --git a/src/tmxviewer/tmxviewer.pro b/src/tmxviewer/tmxviewer.pro
index 88e5b61..3bb0d48 100644
--- a/src/tmxviewer/tmxviewer.pro
+++ b/src/tmxviewer/tmxviewer.pro
@@ -26,7 +26,7 @@ macx {
}
# Make sure the executable can find libtiled
-!win32:!macx {
+!win32:!macx:contains(RPATH, yes) {
QMAKE_RPATHDIR += \$\$ORIGIN/../lib
# It is not possible to use ORIGIN in QMAKE_RPATHDIR, so a bit manually
diff --git a/tiled.pri b/tiled.pri
index 9f7daaf..9598197 100644
--- a/tiled.pri
+++ b/tiled.pri
@@ -1,6 +1,7 @@
# See the README file for instructions about setting the install prefix.
isEmpty(PREFIX):PREFIX = /usr/local
isEmpty(LIBDIR):LIBDIR = $${PREFIX}/lib
+isEmpty(RPATH):RPATH = yes
macx {
# Do a universal build when possible