From ce50187ee71803da24b922760f7b06c4045a6259 Mon Sep 17 00:00:00 2001 From: newEntera Date: Wed, 26 Jul 2017 08:51:31 +0300 Subject: [PATCH] backward compatibility to cmake 3.0 you should either use my backward compatibility which is dirty or take into account my experience and change to minimum required cmake 3.1 --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c73aef0ba5..47ea656eca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,24 @@ ############################################################################ cmake_minimum_required(VERSION 3.0) +# minimum required 3.0 is a bit contradiction to my experience. it should be 3.1 +# because CMake 3.1 introduced the CMAKE_CXX_STANDARD. Cmake 3.1 compiles fine, +# but CMake 3.0 does not have the CMAKE_CXX_STANDARD and then it does not use cxx11 +# then you hit error: +# expected template-name before ‘<’ token error enabled_shared_from_this +# dirty patch +macro(use_cxx11) + if (CMAKE_VERSION VERSION_LESS "3.1") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") + endif () + else () + set (CMAKE_CXX_STANDARD 11) + endif () +endmacro(use_cxx11) +use_cxx11() +#end of dirty patch + project(linphone VERSION 3.12.0 LANGUAGES C CXX)