Skip to content

Commit 47b77da

Browse files
committed
Merge pull request #81 from christiankerl/add_enable_cxx11_option
added cmake option to enable c++11
2 parents e6f6a43 + cd1725e commit 47b77da

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/protonect/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ SET(CMAKE_BUILD_TYPE RelWithDebInfo)
55

66
SET(MY_DIR ${libfreenect2_SOURCE_DIR})
77

8+
OPTION(ENABLE_CXX11 "Enable C++11 support" OFF)
9+
10+
IF(ENABLE_CXX11)
11+
INCLUDE(CheckCXXCompilerFlag)
12+
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
13+
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
14+
IF(COMPILER_SUPPORTS_CXX11)
15+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
16+
ELSEIF(COMPILER_SUPPORTS_CXX0X)
17+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
18+
ELSE()
19+
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
20+
ENDIF()
21+
ENDIF(ENABLE_CXX11)
22+
823
# additional cmake modules
924
LIST(APPEND CMAKE_MODULE_PATH ${MY_DIR}/cmake_modules)
1025

0 commit comments

Comments
 (0)