PDA

View Full Version : Qt Creator Qt SDK 1.1.3 and CMake on Mac OS X 10.7.1 / Lion



agarny
12th September 2011, 08:32
Hi, I have installed Qt SDK 1.1.3 on my Mac (running Mac OS X 10.7.1 / Lion) and rather than installing it under my home directory as suggested by the Qt SDK installer (why does it suggest that in fact?! -- I can't remember whether I installed it using sudo or not, so could it be the issue?), I installed the Qt SDK under /Developer/QtSDK.

Now, my project uses CMake (rather than QMake) and whenever I open my CMakeLists.txt file in Qt Creator 2.3.0 and then run CMake, I get told that Qt can't be found. Note that I have added /Developer/QtSDK/Desktop/Qt/474/gcc/bin to my PATH in my ~/.profile. Still, if in my CMakeLists.txt, I ask CMake to tell me about the contents of my PATH, then it tells me that it contains /usr/bin:/usr/sbin:/sbin, i.e. no /Developer/QtSDK at all. I therefore thought I would update /etc/profile, but to no avail. Same with adding /Developer/QtSDK to /etc/paths or under /etc/paths.d.

So... any idea how I could use Qt SDK 1.1.3 and CMake on Mac OS X 10.7.1 / Lion? Note that if I was to install Qt 4.7.4 and Qt Creator 2.3.0 individually (i.e. as individual packages as opposed to as part of Qt SDK 1.13), then everything works since, since qmake (among others) will be available under /usr/bin (if I recall correctly) which actually begs the question of why Qt SDK 1.1.3 doesn't do the same...?!

agarny
14th September 2011, 22:13
Ok, I have found a solution which involves setting QT_QMAKE_EXECUTABLE to qmake's path, i.e.

SET(QT_QMAKE_EXECUTABLE /Developer/QtSDK/Desktop/Qt/474/gcc/bin/qmake)

I just wish I didn't have to hard-code qmake's path in my CMake file and, instead, be able to do something like

EXECUTE_PROCESS(COMMAND which qmake OUTPUT_VARIABLE QT_QMAKE_EXECUTABLE)

but though this worked fine from the command line, it didn't from within Qt Creator...?! Oh well, at least, I now have a working solution...

agarny
3rd August 2012, 08:56
FWIW, I have revisited this issue since I really didn't like having to hard set QT_QMAKE_EXECUTABLE. So, instead, I rely on the fact that I, personally at least, set Qt's path in /etc/profile:


EXECUTE_PROCESS(
COMMAND sh -c ". /etc/profile && which qmake"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE QT_QMAKE_EXECUTABLE
)