December 15, 2010

mrwienh mrwienh
Lab Rat
1 posts

[Solved] qmake with subdirs

 

Hi,

we are currently compiling a tool library and an application using two different project files (which we load into QT Creator seperately). To make things easier I have been trying to write a project file which combines these two projects using the subdirs template – since we also work with Visual Studio on Windows we hope to also generate VC solutions including 2 projects from this…

I wrote a simple file that sits in a “project” directory which includes the relative paths to the relevant projects (although not really subdirs):

TEMPLATE = subdirs
CONFIG += qt debug_and_release
SUBDIRS = ../libs/mylib ../apps/myapp
myapp.depends = mylib

this generates a Makefile but on compiling gives this error:

Makefile:66: *** multiple target patterns. Stop.

Same error message occurs in QT Creator (although the 2 projects load fine), furthermore the debug or release chooser is not accesible…

What am I doing wrong? Does this happen because my dirs are not really subdirs of the main project file? If so, how do you layout a structure with libraries that span to other projects and thus can’t be subdirs of the app in question?

Many thanks

Markus Wienhöfer

4 replies

December 16, 2010

vcwong vcwong
Lab Rat
6 posts

can you show the generated Makefile?

 Signature 

vcwong

December 16, 2010

mrwienh mrwienh
Lab Rat
1 posts

Hi,

I actually found out that the problem was, that the mylib folder included an older version of the Makefile. I was under the assumption that calling qmake for the subdirs project would also invoke qmake for the sub-projects.

The file loads fine now and compiles BUT:

I am not able to choose any other target than DEBUG in either QT Creator or XCode. The sub projects themselves do compile fine and give me an option between DEBUG and RELEASE. When loading the subdirs project the dropdown is disabled in QT Creator.

All project files do include a line

CONFIG += debug_and_release

though. (the single projects for compiling them individually and the subdirs project for compiling them together)

The bundle project’s Makefile does include targets for Debug, Release and All if I generate a Makefile via qmake -spec macx-g++ and compiles fine for all targets. Only when using the same project file in Creator or create an XCode project from it I’m stuck with Debug only…

December 16, 2010

Duck Duck
Lab Rat
107 posts

What happens if you just leave out the CONFIG += qt debug_and_release line?

December 16, 2010

stuk stuk
Ant Farmer
561 posts

In qtcreator project setting you can able to create specific ‘mode’ compilation, you can add release mode.

 
  ‹‹ Which tools for static code analysis do you use?      How to use QT Creator to create a sidebar and implement close-buttons for tabs? ››

You must log in to post a reply. Not a member yet? Register here!