forked from robotology/gazebo-yarp-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (62 loc) · 3.04 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
# Copyright (C) 2007-2015 Istituto Italiano di Tecnologia ADVR & iCub Facility & RBCS Department
# Authors: Enrico Mingo, Alessio Rocchi, Mirko Ferrati, Silvio Traversaro, Alessandro Settimi and Francesco Romano
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required(VERSION 2.8.7)
PROJECT(GazeboYARPPlugins)
# Project version
set(${PROJECT_NAME}_MAJOR_VERSION 2)
set(${PROJECT_NAME}_MINOR_VERSION 3)
set(${PROJECT_NAME}_PATCH_VERSION 68)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)
# Finding dependencies
find_package(YARP 2.3.64.13 REQUIRED)
find_package(Boost REQUIRED serialization system)
find_package(Protobuf REQUIRED)
find_package(Gazebo REQUIRED)
if (Gazebo_VERSION_MAJOR LESS 5.0)
message(status "Gazebo version : " ${Gazebo_VERSION_MAJOR}.${Gazebo_VERSION_MINOR}.${Gazebo_VERSION_PATCH})
message(FATAL_ERROR "Your Gazebo version is older than Gazebo 5.0. Gazebo Yarp plugins are supported with gazebo versions >= 5.0. Please update to a newer version")
endif()
find_package(SDFormat REQUIRED)
find_package(OGRE QUIET)
# Add Gazebo CXX flags, to support Gazebo 6 reckless dependency on C++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")
# add local cmake scripts
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
#used for dir suffixes
include(GNUInstallDirs)
if (CMAKE_VERSION LESS 3.0)
# hack: by default this would be 'lib/x86_64-linux-gnu' on linux
set(CMAKE_INSTALL_LIBDIR lib)
endif()
OPTION(GAZEBO_YARP_PLUGINS_ENABLE_RPATH "Enable installation with RPATH" TRUE)
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
LIB_DIRS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
DEPENDS GAZEBO_YARP_PLUGINS_ENABLE_RPATH
USE_LINK_PATH)
# Define (depending on CMAKE_BUILD_TYPE) the DEBUG macro
include(AddDebugMacro)
# Enable all possible warning if CMAKE_BUILD_TYPE is debug
include(AddDebugWarnings)
#this is required for all plugins
link_directories(${GAZEBO_LIBRARY_DIRS} ${SDFORMAT_LIBRARY_DIRS} ${PROTOBUF_LIBRARY_DIRS})
#build common libraries first
add_subdirectory(libraries)
#build RPC libraries
add_subdirectory(thrift)
#now build plugins
add_subdirectory(plugins)
include(AddUninstallTarget)
# Install the files necessary to call find_package(GazeboYarpPlugins) in CMake projects
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME}
VARS_PREFIX ${PROJECT_NAME}
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
TARGETS_PROPERTY ${PROJECT_NAME}_TARGETS
NO_CHECK_REQUIRED_COMPONENTS_MACRO)