[cmake] Require C++14 for building IWYU

The LLVM headers require -std=c++14 to parse and several compilers are
not C++14 by default.

IWYU itself currently only needs C++11, but LLVM does not announce its
minimum required C++ standard anywhere in its CMake config, so open up
for C++14 in IWYU by specifying it explicitly.

Fixes #867 and #880.
This commit is contained in:
Kim Grasman 2021-03-13 14:44:04 +01:00 committed by Kim Gräsman
parent 75cb6d99ec
commit c5f3b0fe4c
1 changed files with 5 additions and 0 deletions

View File

@ -93,6 +93,11 @@ add_llvm_executable(include-what-you-use
# available when IWYU is executed from the build dir.
add_dependencies(include-what-you-use clang-resource-headers)
# LLVM requires C++14, so follow suit.
set_property(TARGET include-what-you-use PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET include-what-you-use PROPERTY CXX_STANDARD 14)
set_property(TARGET include-what-you-use PROPERTY CXX_EXTENSIONS OFF)
if (MINGW)
# Work around 'too many sections' error with MINGW/GCC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")