summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2014-08-06 18:53:05 +0200
committerJake Petroules <jake.petroules@petroules.com>2014-09-08 22:19:33 +0200
commitaf155105a9f48e3e96a7f1961732c38ff12465f4 (patch)
treeed7be646e6985b63b9d7bdbfe461a725d78935c0 /qmake
parent935186d76e055083eda75b91488c9affec1fd110 (diff)
qmake: Add QMAKE_SONAME_PREFIX variable
If defined, the value of this variable is prepended to the built shared library's SONAME identifier. For more information, see: qmake/doc/src/qmake-manual.qdoc#qmake-soname-prefix Task-number: QTBUG-31814 Change-Id: I4bceaf0c93162e4fad6bb424af1b82e74d38acdc Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/doc/snippets/code/doc_src_qmake-manual.pro12
-rw-r--r--qmake/doc/src/qmake-manual.qdoc33
-rw-r--r--qmake/generators/unix/unixmake2.cpp7
3 files changed, 52 insertions, 0 deletions
diff --git a/qmake/doc/snippets/code/doc_src_qmake-manual.pro b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
index 07bed62763..1bd89d2f04 100644
--- a/qmake/doc/snippets/code/doc_src_qmake-manual.pro
+++ b/qmake/doc/snippets/code/doc_src_qmake-manual.pro
@@ -970,3 +970,15 @@ int main() { return featureFunction(); }
# <project root>/project.pro
qtCompileTest(test)
#! [182]
+
+#! [183]
+# <project root>/project.pro
+QMAKE_SONAME_PREFIX = @rpath
+#! [183]
+
+#! [184]
+# <project root>/project.pro
+QMAKE_SONAME_PREFIX = @executable_path/../Frameworks
+QMAKE_SONAME_PREFIX = @loader_path/Frameworks
+QMAKE_SONAME_PREFIX = /Library/Frameworks
+#! [184]
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index ad08f729a7..52fc1ec4fb 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -2071,6 +2071,39 @@
qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
needs to be modified.
+ \section1 QMAKE_SONAME_PREFIX
+
+ If defined, the value of this variable is used as a path to be prepended to
+ the built shared library's \c SONAME identifier. The \c SONAME is the
+ identifier that the dynamic linker will later use to reference the library.
+ In general this reference may be a library name or full library path. On OS
+ X and iOS, the path may be specified relatively using the following
+ placeholders:
+
+ \table
+ \header \li Placeholder \li Effect
+ \row \li @rpath
+ \li Expands to paths defined by LC_RPATH mach-o commands in
+ the current process executable or the referring libraries.
+ \row \li @executable_path
+ \li Expands to the current process executable location.
+ \row \li @loader_path
+ \li Expands to the referring executable or library location.
+ \endtable
+
+ In most cases, using \c @rpath is sufficient and recommended:
+
+ \snippet code/doc_src_qmake-manual.pro 183
+
+ However, the prefix may be also specified using different placeholders, or
+ an absolute path, such as one of the following:
+
+ \snippet code/doc_src_qmake-manual.pro 184
+
+ For more information, see
+ \l{https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html}{dyld}
+ documentation on dynamic library install names.
+
\section1 QMAKE_TARGET
Specifies the name of the project target. The value of this
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index e16e0f5c20..c68cebfd8c 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1265,6 +1265,13 @@ void UnixMakefileGenerator::init2()
if(!instpath.endsWith(Option::dir_sep))
instpath += Option::dir_sep;
soname.prepend(instpath);
+ } else if (!project->isEmpty("QMAKE_SONAME_PREFIX")) {
+ QString sonameprefix = project->first("QMAKE_SONAME_PREFIX").toQString();
+ if (!sonameprefix.startsWith('@') && !sonameprefix.startsWith('$'))
+ sonameprefix = Option::fixPathToTargetOS(sonameprefix, false);
+ if (!sonameprefix.endsWith(Option::dir_sep))
+ sonameprefix += Option::dir_sep;
+ soname.prepend(sonameprefix);
}
project->values("QMAKE_LFLAGS_SONAME").first() += escapeFilePath(soname);
}