From 784d468f4b7b038dda654e21ee9af0e2c650e89b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 9 Sep 2021 22:41:26 +0300 Subject: [PATCH] Include llvm from function to guard CMAKE_CXX_STANDARD scope --- contrib/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index e6e098a05b3..b2e97343442 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -206,7 +206,7 @@ elseif(GTEST_SRC_DIR) target_compile_definitions(gtest INTERFACE GTEST_HAS_POSIX_RE=0) endif() -if (USE_EMBEDDED_COMPILER) +function(add_llvm) # ld: unknown option: --color-diagnostics if (APPLE) set (LINKER_SUPPORTS_COLOR_DIAGNOSTICS 0 CACHE INTERNAL "") @@ -219,13 +219,12 @@ if (USE_EMBEDDED_COMPILER) # Need to use C++17 since the compilation is not possible with C++20 currently, due to ambiguous operator != etc. # LLVM project will set its default value for the -std=... but our global setting from CMake will override it. - set (CMAKE_CXX_STANDARD_bak ${CMAKE_CXX_STANDARD}) set (CMAKE_CXX_STANDARD 17) add_subdirectory (llvm/llvm) - - set (CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD_bak}) - unset (CMAKE_CXX_STANDARD_bak) +endfunction() +if (USE_EMBEDDED_COMPILER) + add_llvm() endif () if (USE_INTERNAL_LIBGSASL_LIBRARY)