forked from mit-racecar/racecar_simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (69 loc) · 2.09 KB
/
CMakeLists.txt
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.1)
project(racecar_simulator)
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
######################################
# Compile the library >
######################################
# Add includes
include_directories(include)
file(GLOB SRC_FILES src/*.cpp)
add_library(${PROJECT_NAME} ${SRC_FILES})
target_link_libraries(${PROJECT_NAME} ${LIBS})
set(LIBS ${LIBS} ${PROJECT_NAME})
# Install the library to CMAKE_INSTALL_PREFIX
# which defaults to /usr/local
install(TARGETS ${PROJECT_NAME}
DESTINATION lib)
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include)
######################################
# < End compile the library
######################################
######################################
# ROS >
######################################
# Only run this code in the catkin environment
if(DEFINED CATKIN_DEVEL_PREFIX)
find_package(catkin REQUIRED COMPONENTS
roscpp
tf2
tf2_ros
tf2_geometry_msgs
ackermann_msgs
nav_msgs
sensor_msgs
geometry_msgs
)
# Include catkin_libraries
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
)
set(LIBS ${LIBS} ${catkin_LIBRARIES})
include_directories(include ${catkin_INCLUDE_DIRS})
# Add the nodes
file(GLOB NODE_SRC_FILES node/*.cpp)
foreach(_node_file ${NODE_SRC_FILES})
get_filename_component(_node_name ${_node_file} NAME_WE)
add_executable(${_node_name} ${_node_file})
target_link_libraries(${_node_name} ${LIBS})
endforeach()
# Install the library
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
endif()
######################################
# < End ROS
######################################