Hi,

On Mon, Nov 2, 2015 at 2:49 PM, Boudewijn Rempt <b...@valdyas.org> wrote:

> On Mon, 2 Nov 2015, Andreas Pakulat wrote:
>
> I think the idea of using @rpath as install name of the Qt libraries is
>> geared towards the usecase
>> of shipping Qt within the application bundle of the application. In that
>> case all you need is set
>> the rpath @executable_path/../Frameworks or so in the executable and thus
>> the app-bundle is
>> relocatable. In order to get that with CMake you'll likely need to use
>> the BundleUtilities, though
>> its been so long since I used those I don't know if they can handle this
>> scenario out of the box.
>>
>>
> Yes, that's what I'm trying to do -- well, I'm trying to do two
> things. One is setup a build environment where kde apps like desktoptojson
> can run, the other is creating a bundle, preferably using the same
> Qt. I got quite far by manually fixing up the applications built as part
> of kcoreaddons


That would be fixed in kcoreaddons by extending the linker flags to include
the mentioned -Wl,-rpath,<qtlibdir>. There's no provisioning for this
inside CMake afaik since its hard for it to guess what the intention is. My
understanding (not a OSX expert yet here) is also that having the install
name of a framework on OSX be something like @rpath is quite unusual. Thats
usually something that users are 'patching' when they bundle their
application via install_name_tool. And thats what CMake supports doing via
the BundleUtilities module.


> and then manually patching up the executable inside the
> bundle to have the @executable_path/../Frameworks rpath added. But I'm
> still not sure why with a really simple example things don't work out
> of the box: I guess I had better build Qt with -norpath.


See above, I think the way the Qt frameworks are setup when using -rpath is
simply not expected/anticipated so far by CMake (or the people maintaining
the qt5 cmake modules inside Qt).

However I never tried to use BundleUtilities with such a framework, maybe
they do manage to 'fixup' things for that as well. For a Qt4-based project
I'm using INSTALL_QT4_EXECUTABLE which eventually forwards to fixup_bundle
from BundleUtilities, so may be worth a try to avoid the manual steps.

Even a Qt built with -norpath would require doing some 'manual' things to
get a all-in-one app bundle for the application (or use of
BundleUtilities), to copy things around and adjust the install and link
names in all the frameworks and executables to be related and thus make the
application relocatable.

Andreas
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to