Question about SUBDIRS template in qmake
-
Building with
qmake
on Linux 24.04 withg++
/ Qt 6.9.3 and MSVC on Windows with the same Qt version and alsoqmake
.I am developing a desktop app that depends on some third-party libraries which I am including in the project as source code. At the moment, everything works OK, but I would like to use something like SUBDIRS to manage the build process a bit more flexibly.
For example, when I raise the warning level higher, my own code compiles fine, but I get several more warnings from the 3rd-party code which clutter up the compiler output window. What is the best way of doing this?
At the moment, here is my directory structure:
Project |__app |__include |__src |__qrc |__forms |__translations |__3rd_party |__subproject1 |__subproject2 |__subproject3 |__build |__${QT_VERSION} |__Debug |__.moc |__.obj |__.qrc |__.ui |__Release |__.moc |__.obj |__.qrc |__.ui
Ideally, I would use a SUBDIRS template, and each of the
.pro
files under the3rd_party
folder would specify default warnings (-Wall -Wextra
on Linux with GCC,/W3
on MSVC) but then I could have/W4
or-pedantic-errors
in the main.pro
file configuration.However, if I understand correctly, I need a TARGET directive for each of the subprojects, while all I need to do is to get them to compile and have their object files dumped in the same
.obj
folder used by the main app.What is the best way to approach this? Should I compile the 3rd-party code into static libraries and link them instead of what I am doing?
-
Hi,
Subdirs project are full-blown so your original idea won't work. The static libraries is the correct option.