[Interest] Automatic relink of executable after change in dependant static library

Elvis Stansvik elvstone at gmail.com
Fri Jun 16 22:15:16 CEST 2017


2017-06-16 21:08 GMT+02:00 Enmaniac Software <enmaniac.software at gmail.com>:
> Hi all,
>
>
>
> I hope I am posting it in the right place. This is my first post in this
> mailing list. If that’s not the right place, I would like to apologize and
> feel free to direct me to the correct one.
>
>
>
> As for my question. I am trying to figure out why my executable is not being
> updated when the static library which it depends on gets changed. Here are
> my PRO files.
>
>
>
> Root PRO file:
>
>
>
> TEMPLATE = subdirs
>
> SUBDIRS += myapp staticlib
>
>
>
> myapp.subdir = myapp
>
> staticlib.subdir = staticlib
>
>
>
> myapp.depends = staticlib
>
>
>
> MyApp PRO file:
>
> QT += core
>
> QT -= gui
>
>
>
> CONFIG += c++11
>
>
>
> TARGET = myapp
>
> CONFIG += console
>
> CONFIG -= app_bundle
>
>
>
> TEMPLATE = app
>
>
>
> SOURCES += main.cpp
>
>
>
> # The following define makes your compiler emit warnings if you use
>
> # any feature of Qt which as been marked deprecated (the exact warnings
>
> # depend on your compiler). Please consult the documentation of the
>
> # deprecated API in order to know how to port your code away from it.
>
> DEFINES += QT_DEPRECATED_WARNINGS
>
>
>
> # You can also make your code fail to compile if you use deprecated APIs.
>
> # In order to do so, uncomment the following line.
>
> # You can also select to disable deprecated APIs only up to a certain
> version of Qt.
>
> #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs
> deprecated before Qt 6.0.0
>
>
>
> LIBS += -L$$PWD/../staticlib/debug -lstaticlib
>
> INCLUDEPATH += $$PWD/../staticlib
>
>
>
> Static library PRO file:
>
> QT       -= gui
>
>
>
> TARGET = StaticLib
>
> TEMPLATE = lib
>
> CONFIG += staticlib
>
>
>
> # The following define makes your compiler emit warnings if you use
>
> # any feature of Qt which as been marked as deprecated (the exact warnings
>
> # depend on your compiler). Please consult the documentation of the
>
> # deprecated API in order to know how to port your code away from it.
>
> DEFINES += QT_DEPRECATED_WARNINGS
>
>
>
> # You can also make your code fail to compile if you use deprecated APIs.
>
> # In order to do so, uncomment the following line.
>
> # You can also select to disable deprecated APIs only up to a certain
> version of Qt.
>
> #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs
> deprecated before Qt 6.0.0
>
>
>
> SOURCES += staticlib.cpp
>
>
>
> HEADERS += staticlib.h
>
> unix {
>
>     target.path = /usr/lib
>
>     INSTALLS += target
>
> }
>
>
>
> When the static library is changed, it is recompiled and relinked as
> expected. However, the executable itself is not.
>
> I have tried to use QMAKE from command line and through QtCreator and have
> the same issue (Qt 5.8.0 and QtCreator 4.2.1, Windows 10 x64, MSVC 2015)
>
>
>
> Do I miss something here ?

I think you're looking for PRE_TARGETDEPS [1].

Elvis

[1] http://doc.qt.io/qt-5/qmake-variable-reference.html#pre-targetdeps

>
>
>
> Thanks in advance!
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list