diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-10-09 19:15:58 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:51 -0700 |
commit | 53a5f6d7a46c4bbdddf394f542f20bc1a842c3a0 (patch) | |
tree | 932db576891e6fc4431229710591a763aba8b1b7 | |
parent | 628eb76af456374bbab90f785d8285a916e50399 (diff) | |
download | subsurface-53a5f6d7a46c4bbdddf394f542f20bc1a842c3a0.tar.gz |
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>
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 99e22116e..9d9cb1f60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 |