From fc5c1a29f90f1a1ee53bb64647cc6d19ef30cfc0 Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Tue, 4 Oct 2016 10:17:59 +0200 Subject: [PATCH] Next attempt to get the C++ runtime compiled in Travis CI. --- runtime/Cpp/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/runtime/Cpp/CMakeLists.txt b/runtime/Cpp/CMakeLists.txt index 826ef0b63..06ca1a5d0 100644 --- a/runtime/Cpp/CMakeLists.txt +++ b/runtime/Cpp/CMakeLists.txt @@ -1,6 +1,6 @@ # -*- mode:cmake -*- -cmake_minimum_required (VERSION 3.1) -# 3.1 needed to allow enabling C++11 +cmake_minimum_required (VERSION 2.8) +# 2.8 needed because of ExternalProject # Detect build type, fallback to release and throw a warning if use didn't specify any if(NOT CMAKE_BUILD_TYPE) @@ -60,8 +60,17 @@ endif(WITH_DEMO) set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W") # Initialize CXXFLAGS. -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +if("${CMAKE_VERSION}" VERSION_GREATER 3.1.0) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++11") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${MY_CXX_WARNING_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g ${MY_CXX_WARNING_FLAGS}") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG ${MY_CXX_WARNING_FLAGS}")