Skip to content

Commit a5a2117

Browse files
author
Sammy Pfeiffer
authored
Merge pull request pal-robotics#3 from achim-k/patch-1
Add C++11 compiler flags to CMakeLists.txt
2 parents f1e4825 + d8e6690 commit a5a2117

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
cmake_minimum_required(VERSION 2.8.3)
22
project(gazebo_ros_link_attacher)
33

4+
#####################################
5+
## Check c++11 / c++0x support ######
6+
#####################################
7+
include(CheckCXXCompilerFlag)
8+
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
9+
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
10+
if(COMPILER_SUPPORTS_CXX11)
11+
set(CMAKE_CXX_FLAGS "-std=c++11")
12+
elseif(COMPILER_SUPPORTS_CXX0X)
13+
set(CMAKE_CXX_FLAGS "-std=c++0x")
14+
else()
15+
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
16+
endif()
17+
#####################################
18+
419
# Load catkin and all dependencies required for this package
520
find_package(catkin REQUIRED COMPONENTS
621
roscpp

0 commit comments

Comments
 (0)