-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
151 lines (114 loc) · 4.89 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
# UseSWIG generates now standard target names.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.13)
cmake_policy(SET CMP0078 OLD)
endif()
# UseSWIG honors SWIG_MODULE_NAME via -module flag.
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.14)
cmake_policy(SET CMP0086 OLD)
endif()
# Main project
project(
YARP-ros
VERSION 3.9.0
LANGUAGES C CXX
)
set(PROJECT_DESCRIPTION "YARP-ros: ros interfaces and plugins for YARP")
# Pick up our CMake scripts - they are all in the cmake subdirectory.
set(YARP_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_DIR})
# Find YCM
# This is required here, because YarpVersion uses GitInfo from YCM
set(YCM_REQUIRED_VERSION 0.15.1) # Used also by YarpFindDependencies
find_package(YCM ${YCM_REQUIRED_VERSION} REQUIRED)
find_package(YARP 3.8.0 COMPONENTS os sig dev serversql OPTIONAL_COMPONENTS math REQUIRED)
find_package(YARP 3.8.0 COMPONENTS catch2 QUIET)
# Get the current YARP version.
# See cmake/YarpVersion.cmake.
#include(YarpVersion)
set_property(GLOBAL PROPERTY USE_FOLDERS 1)
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER "Autogen Targets")
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated Files")
# Check system configuration.
# See cmake/YarpSystemCheck.cmake.
#include(YarpSystemCheck)
include(CheckCXXCompilerFlag)
# Set up some compilation options.
# See cmake/YarpOptions.cmake.
#include(YarpOptions)
#########################################################################
# Compile libraries using -fPIC to produce position independent code.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#########################################################################
# Control whether libraries are shared or static (imported from YarpOptions)
option(BUILD_SHARED_LIBS "Compile shared libraries rather than linking statically" ON)
mark_as_advanced(BUILD_SHARED_LIBS)
# Control where libraries and executables are placed during the build.
# With the following settings executables are placed in <the top level of the
# build tree>/bin and libraries/archives in <top level of the build tree>/lib.
# This is particularly useful to run ctests on libraries built on Windows
# machines: tests, which are executables, are placed in the same folders of
# dlls, which are treated as executables as well, so that they can properly
# find the libraries to run. This is a because of missing RPATH on Windows.
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(YARP_DLL OFF)
if(BUILD_SHARED_LIBS)
set(YARP_DLL ON)
endif()
set (YARP_LINK_PLUGINS TRUE)
if(YARP_FORCE_DYNAMIC_PLUGINS OR BUILD_SHARED_LIBS)
set (YARP_LINK_PLUGINS FALSE)
endif()
#########################################################################
# Turn on testing (imported from YarpOptions)
option(YARP_COMPILE_TESTS "Enable YARP tests" OFF)
if(YARP_COMPILE_TESTS)
enable_testing()
endif()
#########################################################################
# Other stuff
message(STATUS "Using:")
message(STATUS " CMake: ${CMAKE_VERSION} (${CMAKE_COMMAND})")
message(STATUS " C Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} (${CMAKE_C_COMPILER})")
message(STATUS " CXX Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} (${CMAKE_CXX_COMPILER})")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMake modules directory: ${CMAKE_MODULE_PATH}")
# Check YARP dependencies, find necessary libraries.
# See cmake/YarpFindDependencies.cmake.
include(YarpFindDependencies)
# Make some custom header files containing compile settings.
#add_subdirectory(cmake)
# Build required 3rd party libraries
add_subdirectory(extern)
#include(YarpInstallationHelpers)
#include(YarpDeprecatedOption)
#yarp_configure_plugins_installation(${PROJECT_NAME})
yarp_configure_external_installation(yarp WITH_PLUGINS)
set(YARP_COMPILE_EXECUTABLES TRUE)
# Set up the main libraries and utilities.
add_subdirectory(src)
# Offer to compile bindings
# add_subdirectory(bindings)
# Tests
add_subdirectory(tests)
# Examples
#add_subdirectory(example)
# Platform independent data
#add_subdirectory(data)
# Documentation
#add_subdirectory(doc)
# Output configuration files describing how YARP was built, and how
# its libraries may be linked against and used. This uses
# information accumulated in the global property variables set up earlier.
# See cmake/YarpDescribe.cmake
#include(YarpDescribe)
# Set up some packaging properties (for generating tarballs etc).
# See cmake/YarpPackage.cmake
#include(YarpPackage)
# add rule for uninstalling YARP
include(AddUninstallTarget)