Qmake app template with pre_targetdeps

I have a QT (C ++) project that has a library that needs to be built before the application starts due to dependencies. My qmake file does the following:

TEMPLATE = MyApp QMAKE_EXTRA_TARGETS += MyDependency MyDependency.depends = FORCE MyDependency.commands = make -C dependencies/MyDependency/ PRE_TARGETDEPS += MyDependency DEPENDPATH += . \ dependencies/MyDependency/ dependencies/MyDependency/utilities INCLUDEPATH += . \ dependencies/MyDependency/ dependencies/MyDependency/utilities LIBS += -Ldependencies/MyDependency/dist LIBS += -lmessageclient \ -lmessages \ -lssutilities \ -lboost_serialization \ -lcommon \ -lmng \ -lz \ -lrt \ -ldl 

My project is very large and I use distcc to take advantage of distributed compilation. However, whenever I run make with several distcc nodes, my project starts compiling MyDependency in addition to my project code, which depends on MyDependency. This causes compilation errors on portions of the code that require the dependency to be created in advance.

If I run qmake and then subsequent make with only 1 distcc node, it will compile MyDependency first and then continue compiling the rest of the project. I also got this to work on other projects using

 CONFIG += ordered TEMPLATE = subdirs 

However, I would prefer to keep the structure the same without having multiple subdirectories and .pro files. Is there a way to accomplish this while still using multiple distcc nodes?

+4
source share

Source: https://habr.com/ru/post/1488512/


All Articles