Dr.Raghnar
Dr.Raghnar

Reputation: 294

Include Makefile into qmake, inheriting properties

Aim

I would like to start a Qt project using another C++ project as starting point that I put in a subdirectory.

Inside /Qt Project/C++ sub-project there is a Makefile with its definition and variables and flags and the source (in different subdirs).

I would like the qt-project to include this makefile and be able to compile all the objects of the sub-project and link them together (with their flags and libs) in the new project.

Attempts

I tried to make use, inside the .pro, mytarget.commands = make -C ./sub-project -f makefile, but this simply uses the makefile, and thus cannot link together with the new main source code that uses Qt.

I tried to link separately all the sub-project in a single object, but ld or ar does not recognize flags.

Upvotes: 2

Views: 389

Answers (1)

yegorich
yegorich

Reputation: 4849

Alternative approach

Have you tried CMake? Just make a central CMakeLists.txt file with all definitions you need and then include CMakeLists.txt files, that you put in either folder Qt and C++. This way you'll have a consistent configuration without mixing Makefiles and qmake stuff.

Here you'll find a Qt + CMake tutorial.

Upvotes: 2

Related Questions