January 10, 2010
You might know that there’s a new kid in the C++ compilers list ; clang. Llvm has been around for quite some time, but until recently the only way to make use of it was through the somehow cumbersome llvm-gcc which binds the gcc C/C++ frontend to the llvm backend. People (mostly Apple) have been working since 2005 on a frontend dedicated to llvm, clang. It is already used ‘in production’ by Apple for the C and objective-c languages.
The C++ part is still very alpha, but i still wanted to play with it. Among other things I wanted to try compiling some Qt projects using qmake. So i hacked this quick&dirty linux-clang mkspec. To use it, uncompress the tgz in your $(QTDIR)/mkspecs/ , edit the clang.conf file to suite your own paths, and do something like:
qmake -recursive -spec linux-clang
I’m using it with Qt-4.6, and it works for me (c). As a last advice, I highly recommend the svn trunk instead of the last release for clang. The website has clear information about how to do this.
* Download linux-clang.qt-4.6.mkspecs.tgz