cpp-best-practices / gui_starter_template

A template CMake project to get you started with C++ and tooling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clang-tidy does checks using c++14 by default (not what specified for the compiler)

c60cb859 opened this issue · comments

Trying to compile a sample project with Qt6 and clang-tidy enabled gives me the following error:

/usr/include/qt6/QtCore/qglobal.h:96:6: error: "Qt requires a C++17 compiler" [clang-diagnostic-error]
#    error "Qt requires a C++17 compiler"

because clang++ runs default with c++14 and not c++17 or with the setting from cmake.
Adding -extra-arg=-std=c++17 in cmake/StaticAnalyzers.cmake in the clang-tidy part, fixes my problem.
I am not sure how to make it inherit the standard set for the compiler options.

CppCheck does not inherit this setting either

This is fixed in ProjectOptions. I recommend you to use that in the meantime until @lefticus merges #169
https://github.com/aminya/ProjectOptions