views:

7952

answers:

3

I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build "Hello, world".

How do I make qmake generate regular makefiles or, if that's something that cannot be done on the Mac, how do I compile .xcodeproj files from the command line?

EDIT: I tried xcodebuild -project myProject -alltargets. I get a lot of output followed by Abort trap.

+20  A: 
$ man xcodebuild

So a typical command might be something like:

$ xcodebuild -project myProject.xcodeproj -alltargets
Olie
I had to write the full name of my project file to get this to work, e.g., myProject.xcodeproj
Jay Conrod
A: 

Looking at this part of your back trace:

# 2008-12-18 20:40:52.333 xcodebuild[1070:613] [MT] ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-921/pbxcore/FileTypes/PBXCFBundleWrapperFileType.m:174 # Details: path should be a non-empty string, but it's an empty string # Object: # Method: -subpathForWrapperPart:ofPath:withExtraFileProperties: # Thread: {name = (null), num = 1}

This implies that something, maybe one of your configuration variables, is blank when it needs to refer to a file. What I'm wondering is if maybe you have an extra target in your project that doesn't work, so that building with -alltargets is what's causing your problem.

I tested xcodebuild without any arguments on one of my projects just now - it did a default build of my project without errors. What happens if you try it without arguments?

Mike Heinz
+6  A: 

The open-source Qt binary installers for OS X from Trolltech default to creating .xcodeproj files when you run qmake. I don't use XCode for editing so it is a pain to open it to compile the project.

To compile your projects from Terminal.app, just set an environment variable of QMAKESPEC to macx-g++

If you want to just compile a certain project from the terminal, go into that directory and run

qmake -spec macx-g++

When you run qmake, this will create a Makefile which you can use by running make.

can state clearly how you set the QMAKESPEC variable to macx-g++i did like QMAKESPEC=macx-g++ at terminal,but when i write the qmake command it was unable to generate a makefile for me
issac
@isaac `export QMAKESPEC=macx-g++` (if you use sh at least)
Alexandre Jasmin