From 38945971d693250badd5faafd214bae3585971c9 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 17 Oct 2019 14:17:49 +0200 Subject: [PATCH] Allow build with different standard if lib used as a subproject --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32bfd90..466faa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,13 @@ cmake_minimum_required(VERSION 3.1) project(Snappy VERSION 1.1.7 LANGUAGES C CXX) -# This project requires C++11. -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +# Allow build with different standard +if(NOT CMAKE_CXX_STANDARD) + # This project requires C++11. + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make # it prominent in the GUI.