aboutsummaryrefslogtreecommitdiffstats
path: root/host/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2016-11-22 16:18:44 -0800
committerMartin Braun <martin.braun@ettus.com>2016-11-22 18:12:07 -0800
commitc818f02e716a12cf33805444b48760174a2a243c (patch)
tree322e9212ab7f504d612c40d0d8af061fac76d15d /host/CMakeLists.txt
parent5ba5adbf1e265633dc2ed09577d87b7c47ecc656 (diff)
downloaduhd-c818f02e716a12cf33805444b48760174a2a243c.tar.gz
uhd-c818f02e716a12cf33805444b48760174a2a243c.tar.bz2
uhd-c818f02e716a12cf33805444b48760174a2a243c.zip
cmake: set c++11 flags in gcc and clang
This will enable all C++11 features that are available on all currently supported compilers. Reviewed-By: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r--host/CMakeLists.txt20
1 files changed, 18 insertions, 2 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 40819f176..a39318f0c 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -80,6 +80,22 @@ ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
ENDIF()
ENDIF()
+
+IF(CMAKE_VERSION VERSION_LESS "3.1")
+ IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ SET(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
+ ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+ IF("${IS_APPLE}" STREQUAL "")
+ SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
+ ELSE()
+ SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
+ ENDIF()
+ ENDIF()
+ELSE()
+ SET(CMAKE_CXX_STANDARD 11)
+ENDIF()
+
+
########################################################################
# Packaging Variables
########################################################################
@@ -174,7 +190,7 @@ INCLUDE(CheckCXXCompilerFlag)
MACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG flag have)
CHECK_CXX_COMPILER_FLAG(${flag} ${have})
IF(${have})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDIF(${have})
ENDMACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG)
@@ -192,7 +208,7 @@ IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR
${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
IF(STRIP_BINARIES)
IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s")
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(STRIP_BINARIES)
ADD_DEFINITIONS(-Wall)