How to prepend CMAKE_LIBRARY_OUTPUT_DIRECTORY to QCoreApplication::libraryPaths() ?

Elvis Angelaccio elvis.angelaccio at kde.org
Sun Mar 11 19:39:44 UTC 2018


On domenica 11 marzo 2018 19:50:44 CET, David Faure wrote:
> On dimanche 11 mars 2018 12:08:27 CET Elvis Angelaccio wrote:
>> Hi,
>> I have a weird crash in ark if I enable the target generation in the bin
>> subfolder [1].
>> The problem is that QCoreApplication::libraryPaths() returns the following
>> list:
>> 
>>     ark.kerfuffle: ("/usr/lib/qt/plugins",
>> "/home/elvis/dev/kde/ark/build/bin")
>> 
>> which means that ark loads first its system-wide plugins, while it should
>> load first the plugins form its build dir.
>> 
>> ECM has code that fixes this problem for test targets [2].
>> I tried to do the same to all the ark targets (main executable, kerfuffle
>> library, plugins), but it doesn't work.
>> Commit message in [2] by David says:
>> 
>>     "This of course requires running the unittests via ctest rather than
>> launching the executable directly."
>> 
>> Does that mean that ctest has some magic that adjusts the library paths?
>
> The magic is the one that is set by that very commit [2] you're referencing:
> it sets $QT_PLUGIN_PATH in the env used by ctest to run the test.

Ah ok, now I understand why it doesn't work for ark :/

>
>> Is it possible to do the same with normal executables?
>
> I don't see how cmake could help, since you're launching the executable 
> directly, not via cmake/ctest.
>
> Solution 1: a change in Qt to add executablePath() to the plugin path, but 
> that got rejected when I tried.
> https://codereview.qt-project.org/203646

Thanks, this link at least has a workaround that I can use (export 
QT_PLUGIN_PATH=.:$QT_PLUGIN_PATH).
But of course the whole point of this effort was to help new contributors, 
so this cannot be a solution for them.

>
> Solution 2 : a wrapper script to launch ark after setting the plugin path.
> This seems to be the qmake solution. See the uic_wrapper.sh 
> files anywhere in 
> the builddir of any qmake project...
>
> I guess we could make ECM generate such wrapper scripts for all non-test 
> executables...

Sounds good!

Cheers,
Elvis



More information about the Kde-buildsystem mailing list