This repository has been archived by the owner on Apr 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
104 lines (82 loc) · 4.26 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
# Copyright: (C) 2010 RobotCub Consortium
# Authors: Lorenzo Natale
# CopyPolicy: Released under the terms of the GNU GPL v2.0.
#### CMake Setup
cmake_minimum_required(VERSION 2.8.11)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
#### CoDyCo Setup
project(codyco-modules)
find_package(whole-body-controllers)
if(whole-body-controllers_FOUND)
message(FATAL_ERROR "codyco-modules cannot be installed if whole-body-controllers is already installed. "
"Please uninstall whole-body-controllers before trying to install codyco-modules. "
"If you are installing codyco-modules as part of a superbuild, a solution "
"is to simply manually remove the superbuild's install directory, and then compile "
"the superbuild again.")
endif()
set(VARS_PREFIX ${PROJECT_NAME})
set(${PROJECT_NAME}_VERSION_MAJOR "0")
set(${PROJECT_NAME}_VERSION_MINOR "3")
set(${PROJECT_NAME}_VERSION_PATCH "0")
set(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")
find_package(YARP REQUIRED)
set(YARP_REQUIRED_VERSION 3.0)
if(${YARP_VERSION} VERSION_LESS ${YARP_REQUIRED_VERSION})
message(FATAL_ERROR "YARP version ${YARP_VERSION} not sufficient, at least version ${YARP_REQUIRED_VERSION} is required.")
endif()
message(STATUS "YARP is version: ${YARP_VERSION}")
if (YARP_HAS_MATH_LIB)
set(ICUB_HAS_YARP TRUE CACHE BOOL "" FORCE)
message(STATUS "found libYARP_math")
else(YARP_HAS_MATH_LIB)
set(ICUB_HAS_YARP FALSE CACHE BOOL "" FORCE)
message(FATAL_ERROR "YARP was found, but no libYARP_math was detected, please recompile yarp")
endif(YARP_HAS_MATH_LIB)
add_definitions(${YARP_DEFINES}) #this contains also -D_REENTRANT
# include YARP CMake modules
set(CMAKE_MODULE_PATH ${YARP_MODULE_PATH} ${CMAKE_MODULE_PATH})
#### find dependencies and set variables
include(CoDyCoFindDependencies)
# Import common options (disable flags in windows, rpath, etc..)
include(CoDyCoOptions)
# Force dynamic plugins. Must be set before
# yarp_configure_external_installation to ensure that codyco.ini is
# generated correctly
set(YARP_FORCE_DYNAMIC_PLUGINS TRUE CACHE INTERNAL "CoDyCo is always built with dynamic plugins")
include(YarpInstallationHelpers)
yarp_configure_external_installation(codyco WITH_PLUGINS)
# Hide YARP_FORCE_DYNAMIC_PLUGINS from gui
# (yarp_configure_external_installation changes TYPE to BOOL)
set_property(CACHE YARP_FORCE_DYNAMIC_PLUGINS PROPERTY TYPE INTERNAL)
#### Find iCub
find_package(ICUB REQUIRED)
#### Set binary dir to ${CMAKE_BINARY_DIR}/bin
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
make_directory(${EXECUTABLE_OUTPUT_PATH})
mark_as_advanced(EXECUTABLE_OUTPUT_PATH)
#### Set library dir to ${CMAKE_BINARY_DIR}/lib
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
make_directory(${LIBRARY_OUTPUT_PATH})
mark_as_advanced(LIBRARY_OUTPUT_PATH)
### Print author warnings when a cmake_minimum_required version is higher then a given cmake version
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
# Just a reminder to remove some workarodunds when we change cmake version
message(AUTHOR_WARNING "CMake minimum required version greater than 2.8.12 . You can now get rid of the include_directories(SYSTEM ..) and substitute them with target_include_directories(... SYSTEM ...) .")
message(AUTHOR_WARNING "CMake minimum required version greater than 2.8.12 . You can now get rid of the target_link_libraries(... LINK_PUBLIC ...) and substitute them with target_link_libraries(... PUBLIC ...) .")
endif()
if (CODYCO_BUILD_TESTS)
include (CTest)
endif()
add_subdirectory(src)
# Export IDL libraries to simplify RPC communication
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME} VARS_PREFIX ${VARS_PREFIX}
VERSION ${${VARS_PREFIX}_VERSION}
COMPATIBILITY SameMajorVersion
TARGETS_PROPERTY ${VARS_PREFIX}_TARGETS
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
#### add the "uninstall" target
include(AddUninstallTarget)