Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] Custom Build Process
Luthais last edited by
I am new to Qt and evaluating it to possibly switch over from VS. However, I am having trouble setting up my project and could use some help.
I have a chain of static libraries that depend on one another. At some point in the chain it branches into two parallel sets of libraries (client/server). Here is a simplified overview of my setup:
Utilities --> MetaData --> Networking --> Common --> Client
Utilities --> MetaData --> Networking --> Common --> Server
So I have two issues:
- When building the subdirs project, I need the Common subproject to be built twice, each time with a different preprocessor define, a different build directory, and a different output file. Maintaining two projects that are otherwise identical has historically been way too much of a pain.
- Since all of these subprojects depend on one another I need to make sure the build order is as listed above.
This project is being worked on by a small team, so I would like a minimal amount of custom setup/configuration needed per machine. I would also like to keep both Client and Server subprojects under the same subdirs project if possible, as it makes it much easier to work on both in parallel.
I accomplished the first task above in VS by creating custom build configurations and it works flawlessly for what I need. My limited knowledge of makefiles and Qt Creator suggests this would not be the best approach here.
Any help would be greatly appreciated! Apologies if this is already covered elsewhere. I assume it probably is but for the life of me I could not find anything after a few days of searching and experimenting.
Hi and welcome to devnet,
If you are using qmake you should have a look at the subdir template which does what are looking after. You can even tell it the order of compilation of the sub-project.
Hope it helps
Luthais last edited by
Thank you much.
As you suggested, the use of .pri files did indeed resolve my issues. I just removed the Common.lib entirely and built the entire set of files directly into both Client and Server projects, while still keeping it separate from both.
Sorry for the delayed response, the past few days have been something of a crash course for me. A decade of using MSVC/XCode exclusively has not left me with the need to mess with makefiles and whatnot. The number of things I had to learn coupled with fixing code that was not GCC compliant kept me pretty busy. The need to link libraries in reverse dependency order was particularly frustrating.
You're welcome !
Since your project is building now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)