Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Qt Xcode Projects From the Command Line

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?

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

like image 213
Ankur Sethi Avatar asked Dec 18 '08 14:12

Ankur Sethi


2 Answers

$ man xcodebuild

So a typical command might be something like:

$ xcodebuild -project myProject.xcodeproj -alltargets
like image 136
Olie Avatar answered Nov 11 '22 13:11

Olie


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.

like image 21
user47488 Avatar answered Nov 11 '22 14:11

user47488