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

Enmaniac Software enmaniac.software at gmail.com
Sat Jun 17 01:06:29 CEST 2017


All that makes sense now.
Thanks again!

-----Original Message-----
From: Konstantin Tokarev [mailto:annulen at yandex.ru] 
Sent: Friday, June 16, 2017 11:23 PM
To: Enmaniac Software; 'Elvis Stansvik'
Cc: interest at qt-project.org
Subject: Re: [Interest] Automatic relink of executable after change in dependant static library



16.06.2017, 23:36, "Enmaniac Software" <enmaniac.software at gmail.com>:
> Ah indeed. It worked!
>
> To recap: I have added the following to MyApp PRO file:
> PRE_TARGETDEPS += $$PWD/../staticlib/debug/staticlib.lib
>
> It’s a bit pity that PRE_TARGETDEPS takes the absolute path to the file rather than simply the target name (thus resolving the path on its own depending on OS and naming conventions)

Each .pro file is a separate project which does not share any information with other projects, except via same .pri/.prf files included in different projects, or qmake variables set via qmake parameters when qmake is run for top-level SUBDIRS project.

So, no qmake project is aware of neither target names defined in other projects, nor their build artifacts, unless you share this data explicitly with .pri files

>
> Thank you Thiago and Elivs for the help!
>
> -----Original Message-----
> From: Elvis Stansvik [mailto:elvstone at gmail.com]
> Sent: Friday, June 16, 2017 10:15 PM
> To: Enmaniac Software
> Cc: interest at qt-project.org Interest
> Subject: Re: [Interest] Automatic relink of executable after change in dependant static library
>
> 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
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin




More information about the Interest mailing list