From d2179014f9f3be21873a4cf7d7bde5cbe7148daf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Dec 2012 12:34:37 +0100 Subject: introduce QMAKE_RPATHLINKDIR (and QMAKE_LFLAGS_RPATHLINK) complementary to QMAKE_RPATHDIR. this avoids that we need to sprinkle linux/gcc specific code all over the place. Task-number: QTBUG-27427 Change-Id: Iebafd1749d1a0d803704902473df8c743f074ddc Reviewed-by: Joerg Bornemann --- mkspecs/common/gcc-base-unix.conf | 1 + mkspecs/features/qt_functions.prf | 7 ++++--- qmake/generators/unix/unixmake.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mkspecs/common/gcc-base-unix.conf b/mkspecs/common/gcc-base-unix.conf index dc8d7e42cd..dadaecaa29 100644 --- a/mkspecs/common/gcc-base-unix.conf +++ b/mkspecs/common/gcc-base-unix.conf @@ -15,6 +15,7 @@ QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_SONAME += -Wl,-soname, QMAKE_LFLAGS_THREAD += QMAKE_LFLAGS_RPATH = -Wl,-rpath, +QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link, # -Bsymbolic-functions (ld) support QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index d73d402b0c..ec5becbdde 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -115,12 +115,12 @@ defineTest(qtAddModule) { PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB} # Make sure we can link to uninstalled libraries - unix:!mac:!isEmpty(QT.$${1}.libs) { # Use unmodified path, so /usr/lib also works + !isEmpty(QT.$${1}.libs) { # Use unmodified path, so /usr/lib also works for(rpl, QT.$${1}.rpath_link): \ - QMAKE_LFLAGS *= -Wl,-rpath-link,$$rpl + QMAKE_RPATHLINKDIR *= $$rpl !auto_use_privates:!isEqual(2, UsePrivate): \ for(rpl, QT.$${1}.rpath_link_private): \ - QMAKE_LFLAGS *= -Wl,-rpath-link,$$rpl + QMAKE_RPATHLINKDIR *= $$rpl } } # Only link to this module if a libs directory is set, else this is just a module @@ -139,6 +139,7 @@ defineTest(qtAddModule) { export(QMAKE_LFLAGS) export(QMAKE_LIBDIR) export(QMAKE_RPATHDIR) + export(QMAKE_RPATHLINKDIR) export(PRE_TARGETDEPS) return(true) } diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 82fd47f2ec..8a1a29c2c7 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -170,6 +170,13 @@ UnixMakefileGenerator::init() project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + escapeFilePath(QFileInfo(rpathdirs[i].toQString()).absoluteFilePath()); } } + if (!project->isEmpty("QMAKE_RPATHLINKDIR")) { + const ProStringList &rpathdirs = project->values("QMAKE_RPATHLINKDIR"); + for (int i = 0; i < rpathdirs.size(); ++i) { + if (!project->isEmpty("QMAKE_LFLAGS_RPATHLINK")) + project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATHLINK") + escapeFilePath(QFileInfo(rpathdirs[i].toQString()).absoluteFilePath()); + } + } if(project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) include_deps = true; //do not generate deps -- cgit v1.2.3