forked from intel/gazebo-sitl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
43 lines (36 loc) · 1.2 KB
/
Copy pathCMakeLists.txt
File metadata and controls
43 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_program(PYTHON python)
if (NOT PYTHON)
message(SEND_ERROR "Python not found")
endif()
# Generate Mavlink Messages
if(NOT EXISTS ${CMAKE_BINARY_DIR}/lib/)
execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/modules/mavlink
COMMAND
${PYTHON}
-m pymavlink.tools.mavgen
-o ${CMAKE_BINARY_DIR}/lib
--lang C
./message_definitions/v1.0/common.xml)
endif()
# Find Gazebo and Includes
find_package(gazebo REQUIRED)
include_directories(
${GAZEBO_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/lib/common
${CMAKE_BINARY_DIR}/lib)
link_directories(
${GAZEBO_LIBRARY_DIRS})
if (GZSITL_INSTALL_PATH)
set(GZSITL_PLUGIN_PATH ${GZSITL_INSTALL_PATH})
else()
set(GZSITL_PLUGIN_PATH ${GAZEBO_PLUGIN_PATH})
endif()
set(CUSTOM_COMPILE_FLAGS "-Wall")
set(LDFLAGS "-z noexecstack -z relro -z now")
set(CFLAGS "-fstack-protector-all -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2")
set(CFLAGS "${CFLAGS} -Wformat -Wformat-security")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CFLAGS} ${CUSTOM_COMPILE_FLAGS}")
add_subdirectory(gzsitl)