问题
I am attempting to build Qt 5.4.1 pulled from git with the -std=c++14 flag for gcc4.9. But I am not sure about how to properly pass the flag into the build process.
I have read that adding CONFIG += c++14 to a qt project file should work since Qt5.4, so I have added it into the qt.pro located in the top folder.
But Qt is still compiled with -std=c++0x (c++11).
回答1:
If you using g++ or clang++ to build the Qt 5, then go to qt5/qtbase/mkspecs/common/g++-base.conf or qt5/qtbase/mkspecs/common/clang.conf respectively and simply change the right hand side of QMAKE_CXXFLAGS_CXX11 = -std=c++11 assignment to (for example) -std=gnu++1z (or to whatever you need).
To build Qt 5 you have to run qt5/configure script with -c++11 provided (and -platform linux-clang-libc++ or linux-clang or linux-g++ or whatever you need — the parameter is the qt/qtbase/mkspecs/*/ directory name represented your platform).
来源:https://stackoverflow.com/questions/28551609/how-to-build-qt-5-from-source-with-c14-support