From: Yonghong Song Date: Wed, 10 Aug 2022 07:13:43 +0000 (-0700) Subject: fix a llvm compilation error with llvm16 X-Git-Tag: accepted/tizen/unified/20240223.064455~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7519dc83e35f731859ca1818cd4d764fa45ae06a;p=platform%2Fupstream%2Fbcc.git fix a llvm compilation error with llvm16 LLVM16 patch https://github.com/llvm/llvm-project/commit/b4e9977fc18405d4a11cbaf1975bcadbf75920b8 caused bcc build failure like below: from /.../bcc/src/cc/frontends/clang/b_frontend_action.cc:23: /.../llvm-project/llvm/build/install/include/llvm/ADT/StringRef.h:96:54: error: expected β€˜)’ before β€˜Str’ /*implicit*/ constexpr StringRef(std::string_view Str) ~ ^~~~ ) /.../llvm-project/llvm/build/install/include/llvm/ADT/StringRef.h:239:14: error: expected type-specifier operator std::string_view() const { ^~~ LLVM build itself now is done with c++17. Let us also compile with c++17 if bcc is built with llvm16. Signed-off-by: Yonghong Song --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d5fd9e7..87f85e0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,11 @@ if (USINGISYSTEM AND GCC_VERSION VERSION_LESS 6.0) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 14) +if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16) + set(CMAKE_CXX_STANDARD 17) +else() + set(CMAKE_CXX_STANDARD 14) +endif() endif(NOT PYTHON_ONLY)