Use clang as default compiler for Qt projects

There are two ways to set clan as your default compiler in Qt-Creator. One way will set LLVM as default in Qt-Creator for you only and the other one will set LLVM as default for your project, so everyone cloning/forking your repo will use clang too. If you want clang as default only for you, go in Qt-Creator to Tools -> Options -> Build & Run -> Kits select your default kit, I have `Desktop` and set Compiler to CLang. qtcreator_llvm Second option, for your whole project: add the following lines to your file.


Execute the commands below to have clean directory:

make clean && rm Makefile

When you start compilation and output lines start with `clang`, you are using clang.

clang -c -pipe -std=c++11 -Wno-write-strings -Wno-unused-variable -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I/usr/lib/qt/mkspecs/linux-clang -I. -I. -Isrc/headers -Isrc/src -Irsc -isystem /usr/include/qt -isystem /usr/include/qt/QtPrintSupport -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtSql -isystem /usr/include/qt/QtCore -I.moc -I. -o .obj/MyClass.o src/src/MyClass.cpp