Important: Please read the Qt Code of Conduct -

Linking an exe against static libraries using shadowbuild directories...

  • Hi,

    I plan to use QtCreator for my crossplatform Qt applications after spending years using custom makefiles...
    Now I'm developping for both windows, linux-x86 and raspberrypi2

    Using QTCreator, I let the shawbuild option on as it's strongly recommended.

    e.g. the shadowbuild are generated in:


    However, myexe is statically linked against mylib.

    But in the project of myexe, I need to specify the path to locate mylib.
    If the variable $$OUT_PWD does refect the build directory of myexe, I've no way to retrieve the destination dir of mylib.

    Well, there are many workarounds to solve this problem, but I'd like to find the proper way to fix it.
    I mean in a "qmake" style !

    Any suggestion is greatly welcome.


  • Moderators

    @zyend said:

    But in the project of myexe, I need to specify the path to locate mylib.

    you rather need to specify the path relative to your project file than to your exe in the output directory.

  • Sorry, I don't understand what you mean.
    The library (mylib.lib) is located in its respective shadowbuild directory.

    But somewhere in, I expect having something like:

    win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../**xxx**/libmylib.lib

    But currently, "xxx" is the shadowbuild directory and I can't guess its exact path.

  • Moderators

    ok my answer was regarding qmake only sry.
    For a qmake only solution you could define the target directory for the lib, and specify this path (relatively) in your myexe pro file.

    But IIRC QtCreator solely ignores the output dirs specified in the qmake pro-file and uses it's custom settings instead. See this, to link to an internal project in QtCreator.