From 997570091b4bafb302fdb9e9edd3b22fc77f541b Mon Sep 17 00:00:00 2001 From: Anonymous <10565180+infomaniac777@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:57:40 +0530 Subject: [PATCH] Fix CXX version build issue in Apple clang --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f791390c680..0db6607fdb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,15 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) option(ABSL_ENABLE_INSTALL "Enable install rule" OFF) else() option(ABSL_ENABLE_INSTALL "Enable install rule" ON) + if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + message("CXX standard set to 14.") + endif() +endif() + +if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14) + message(FATAL_ERROR "Abseil requires at least C++14.") endif() set(CMAKE_INSTALL_RPATH "$ORIGIN")