aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Rode <andrej.rode@ettus.com>2017-02-10 10:11:38 -0800
committerMartin Braun <martin.braun@ettus.com>2017-02-10 16:44:12 -0800
commitf3a004faf7d50cbb5564f5e2f67f54ee07e051dd (patch)
tree103731903abda1f76578474e858f69286147c167
parentcc769d1b532df2c636edca0bda951b3c5e919de2 (diff)
downloaduhd-f3a004faf7d50cbb5564f5e2f67f54ee07e051dd.tar.gz
uhd-f3a004faf7d50cbb5564f5e2f67f54ee07e051dd.tar.bz2
uhd-f3a004faf7d50cbb5564f5e2f67f54ee07e051dd.zip
init_usrp: add c++11 flags to compiler if available
-rw-r--r--host/examples/init_usrp/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/host/examples/init_usrp/CMakeLists.txt b/host/examples/init_usrp/CMakeLists.txt
index 4ce51125f..139f9b853 100644
--- a/host/examples/init_usrp/CMakeLists.txt
+++ b/host/examples/init_usrp/CMakeLists.txt
@@ -46,6 +46,25 @@ find_package(UHD "3.8.0" REQUIRED)
#find_package(UHD 3.8.1 EXACT REQUIRED)
### Configure Compiler ########################################################
+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()
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+ SET(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}")
+ SET(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
+ENDIF()
+
include_directories(
${Boost_INCLUDE_DIRS}
${UHD_INCLUDE_DIRS}