qt 确实将路径硬编码到了qmake中, 但是会优先寻找qt.conf 如果有就使用qt.conf中配置的路径,没有则使用默认路径。
比如以下路径:
[Paths]
Prefix=/opt/Qt/Qt4.8.0
如果编译时候出现错误:QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: XXXXX.pro
是QMAKESPEC变量没有设置好,在/root/.bash_profile里加入一行:
export QMAKESPEC=/usr/local/qt-x11-opensource-src-4.3.2/mkspecs/linux-g++(即是linux-g++的路径)。
参考网址