Dienstag, 31. Januar 2017

Configure Qt Creator to develop C++14 applications with CMake and CLang

The following example shows how to import a C++14 cmake project into Qt Creator. The project will use CLANG to compile the sources and it will also use CLANG for code completion.

Enable the ClangCodeModel for the code completion: Help -> About Plugins...
 
Next select the CLANG compiler and enable the CodeBlocks - Unix Makefiles project generator for cmake in Tools -> Options...: 

Add the following line to your CMakeLists.txt file so that CLANG will compile using the C++14 standard:
SET (CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -std=c++14")
and then open the CMakeLists.txt: File -> Open File or Project... and click Configure Project:


Now the project should be correctly set up.
You can change the build type (release, debug) in Build -> Open Build and Rund Kit Selector...:
 

Keine Kommentare:

Kommentar veröffentlichen