Make code compile in gnu11 and c++11

This is to make it possible to use some nice to have features of
c11 and c++11 like range based loops, delete default functions,
auto variable assignment. Talked to Dirk about this and he is ok
with the change, but he also states that he will not accept lambdas

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-10-09 19:15:58 -03:00 committed by Dirk Hohndel
parent 628eb76af4
commit 53a5f6d7a4

View file

@ -3,6 +3,7 @@
project(Subsurface)
cmake_minimum_required(VERSION 2.8.11)
# global settings
set(CMAKE_AUTOMOC ON)
@ -55,9 +56,19 @@ execute_process(
message(STATUS "Creating build files for Subsurface ${SSRF_VERSION_STRING}")
# compiler specific settings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 ")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel C++
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
endif()
# pkgconfig for required libraries