daj
daj

Reputation: 7173

Qt 5.1 for OSX installation only includes clang_64 directory, how do I compile with macports gcc?

I want to use macports gcc 4.9 with Qt/Qt creator on OSX. The problem is that the 5.1 installation only has a clang_64 directory and no obvious gcc directory. If I set the compiler to gcc 4.9 under preferences/build & run and point Qt to use the qmake under the clang_64 directory, it automatically calls clang++ instead of the gcc executable I specified.

I'm using macports gcc instead of clang because clang requires the system libc++ to be updated and support c++11 features to use them. I'm running OSX 10.6, so from what I understand this is a no go as far as c++11 clang is concerned.

Upvotes: 2

Views: 1500

Answers (1)

daj
daj

Reputation: 7173

Figured out one way to do it, although it is kind of hacky (Qt creator effectively ignores its own compiler settings). Use the Qt 5.1 qmake (doesn't matter that it's in the clang_64 directory). In the .pro file, add:

QMAKE_CC = gcc-mp-4.9
QMAKE_CXX = g++-mp-4.9
QMAKE_LINK = g++-mp-4.9
QMAKE_CXXFLAGS += -std=c++11

Seems to do the trick. Please comment if there's a problem with this solution / a better solution.

Upvotes: 3

Related Questions