[Solved] qmake with subdirs
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?
can you show the generated Makefile?
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...
What happens if you just leave out the CONFIG += qt debug_and_release line?
In qtcreator project setting you can able to create specific 'mode' compilation, you can add release mode.