forked from robotology/navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (85 loc) · 3.46 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Copyright (C) 2021 IIT Istituto Italiano di Tecnologia
# Author: Marco Randazzo marco.randazzo@iit.it
# CopyPolicy: Released under the terms of the GNU GPL v2.0.
cmake_minimum_required(VERSION 3.12)
set(ROOT_PROJECT_NAME navigation)
project(${ROOT_PROJECT_NAME} LANGUAGES C CXX
VERSION 1.19.2)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(YCM_REQUIRED_VERSION 0.11.0)
set(YARP_REQUIRED_VERSION 3.7)
find_package(YCM ${YCM_REQUIRED_VERSION} REQUIRED)
find_package(YARP ${YARP_REQUIRED_VERSION} REQUIRED)
option(NAVIGATION_USE_ROS2 "if enabled, ROS2 related executables/plugins will be compiled" OFF)
option(NAVIGATION_USE_NWC "if enabled, yarp nwc devices instead of standard clients" ON)
if(NAVIGATION_USE_NWC)
add_definitions(-DNAVIGATION_USE_NWC=1)
endif()
if(YARP_math_FOUND)
set(ICUB_HAS_YARP TRUE CACHE BOOL "" FORCE)
message(STATUS "found libYARP_math")
else()
set(ICUB_HAS_YARP FALSE CACHE BOOL "" FORCE)
message(FATAL_ERROR "YARP was found, but no libYARP_math was detected, please recompile yarp")
endif()
include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
find_package(YCM REQUIRED)
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
LIB_DIRS "${CMAKE_INSTALL_FULL_LIBDIR}"
INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}"
USE_LINK_PATH)
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()
#### Find YARP, require that YARP version is at least ICUB_REQYARP_VERSION
find_package(YARP 3.5 COMPONENTS os sig dev math gsl rosmsg idl_tools REQUIRED)
message(STATUS "YARP is version: ${YARP_VERSION}")
yarp_configure_external_installation(${PROJECT_NAME} WITH_PLUGINS)
#### Find iCub
find_package(ICUB)
list(APPEND CMAKE_MODULE_PATH ${ICUB_MODULE_PATH})
find_package(OpenCV)
find_package(GSL)
find_package(SDL)
if(NAVIGATION_USE_ROS2)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2_msgs REQUIRED)
find_package(test_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
endif()
add_subdirectory(src)
add_subdirectory(app)
set_property(GLOBAL PROPERTY USE_FOLDERS 1)
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME}
NAMESPACE navigation::
VERSION ${${PROJECT_NAME}_VERSION}
EXPORT navigation
COMPATIBILITY AnyNewerVersion
DEPENDENCIES ICUB
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
include(AddUninstallTarget)