-
Notifications
You must be signed in to change notification settings - Fork 76
/
CMakeLists.txt
186 lines (151 loc) · 6.9 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#
# Test CMake version
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
IF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy AND ${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
###################################################
# #
# Start project customization section #
# #
###################################################
PROJECT(orocos-rtt)
SET( RTT_VERSION 2.7.0 )
STRING( REGEX MATCHALL "[0-9]+" RTT_VERSIONS ${RTT_VERSION} )
LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR)
LIST( GET RTT_VERSIONS 1 RTT_VERSION_MINOR)
LIST( GET RTT_VERSIONS 2 RTT_VERSION_PATCH)
MESSAGE( "Orocos RTT version ${VERSION} (${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}.${RTT_VERSION_PATCH})" )
SET( PROJ_SOURCE_DIR ${orocos-rtt_SOURCE_DIR} )
SET( PROJ_BINARY_DIR ${orocos-rtt_BINARY_DIR} )
# Load the optional orocos-rtt.cmake file.
INCLUDE(${PROJ_SOURCE_DIR}/orocos-rtt.cmake OPTIONAL)
if (NOT EXISTS ${PROJ_SOURCE_DIR}/orocos-rtt.cmake)
# Setup the default settings
MESSAGE(
"No orocos-rtt.cmake file loaded, using default settings."
"See orocos-rtt.default.cmake")
INCLUDE(${PROJ_SOURCE_DIR}/orocos-rtt.default.cmake)
endif ()
# On Windows, the default CMAKE_INSTALL_PREFIX is either:
# C:\Program Files\orocos-rtt or C:\Program Files (x86)\orocos-rtt
# However, we want it to be either:
# C:\Program Files\orocos or C:\Program Files (x86)\orocos
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF (MSVC)
STRING(REPLACE "${PROJECT_NAME}" "orocos" OROCOS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
SET(CMAKE_INSTALL_PREFIX
${OROCOS_INSTALL_PREFIX} CACHE PATH "Orocos install prefix" FORCE
)
ENDIF(MSVC)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Tell deployer to use ROSlib support.
set(ROSLIB_SUPPORT TRUE)
include(config/FindRoslib.cmake)
#Use these variables to store build-local flags.
#They are used when the targets are configured.
IF ( NOT CMAKE_BUILD_TYPE STREQUAL "None")
SET ( CMAKE_CXX_FLAGS_ADD "${CMAKE_CXX_FLAGS}" CACHE STRING "Specify here your additional C++ flags.")
SET ( CMAKE_C_FLAGS_ADD "${CMAKE_C_FLAGS}" CACHE STRING "Specify here your additional C flags.")
SET ( CMAKE_LD_FLAGS_ADD "${CMAKE_LD_FLAGS}" CACHE STRING "Specify here your additional link flags.")
ENDIF ( NOT CMAKE_BUILD_TYPE STREQUAL "None")
# Export file name
set(LIBRARY_EXPORT_FILE "orocos-rtt-${OROCOS_TARGET}-libraries")
# The installation dir suffix for the 'orocos' directory
if ( NOT OROCOS_SUFFIX )
set(OROCOS_SUFFIX /${OROCOS_TARGET}) # defaults to the target name
endif( NOT OROCOS_SUFFIX )
# Make compilation verbose
#SET(CMAKE_VERBOSE_MAKEFILE TRUE)
###################################################
# #
# End project customization section #
# #
###################################################
OPTION(ENABLE_TESTS "Turn on to enable the testing framework." OFF)
SET(BUILD_TEST_TIMEOUT 1500 CACHE STRING "Global timeout on all tests (seconds).")
IF(ENABLE_TESTS)
SET(DART_TESTING_TIMEOUT "${BUILD_TEST_TIMEOUT}" CACHE STRING "" FORCE)
INCLUDE(CTest)
ENABLE_TESTING()
ENDIF()
IF(BUILD_TESTING)
SET(BUILDNAME "${BUILDNAME}" CACHE STRING "Name of build on the dashboard")
MARK_AS_ADVANCED(BUILDNAME)
ENDIF(BUILD_TESTING)
# turn on code coverage of tests
include (CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(BUILD_ENABLE_COVERAGE "Turn on code coverage of all tests." OFF "ENABLE_TESTS" OFF)
IF (BUILD_ENABLE_COVERAGE)
# coverage requires test
SET(ENABLE_TESTS ON CACHE BOOL "" FORCE)
ENDIF (BUILD_ENABLE_COVERAGE)
# MESSAGE("Looking for compiler:")
INCLUDE (${CMAKE_ROOT}/Modules/CMakeDetermineCXXCompiler.cmake)
###################################################
# #
# Do some global set-up & checking #
# #
###################################################
# Find all installed libraries, compiler etc.
INCLUDE(config/check_depend.cmake)
## Uninstall target
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/config/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
INCLUDE(config/rtt_macros.cmake)
###########################################################
# #
# Visit subdirs #
# #
###########################################################
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_SUBDIRECTORY(rtt)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(tests)
#############################
# #
# Building Doxygen documents#
# #
#############################
ADD_CUSTOM_TARGET(docs echo "Documentation built.")
ADD_DEPENDENCIES(docs dochtml docpdf)
IF (DOXYGEN_EXECUTABLE)
ADD_CUSTOM_TARGET(docapi ${DOXYGEN_EXECUTABLE} "Doxyfile")
ADD_DEPENDENCIES(docs docapi)
CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
ENDIF (DOXYGEN_EXECUTABLE)
###############################
# #
# Package configuration files #
# #
###############################
set(CONFIG_FILE_PATH "lib/cmake/orocos-rtt") # Folder lib/cmake is searched by default in CMake >= 2.6.3
set(IMPORTED_TARGET_PREFIX "imported_") # Prefix used in other projects to distinguish imported targets from regular ones
# Main package configuration file + target specific file
CONFIGURE_FILE(orocos-rtt-config.cmake.in
orocos-rtt-config-${OROCOS_TARGET}.cmake @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/orocos-rtt-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/orocos-rtt-config-${OROCOS_TARGET}.cmake
DESTINATION "${CONFIG_FILE_PATH}")
# Version file
CONFIGURE_FILE(orocos-rtt-config-version.cmake.in
orocos-rtt-config-version.cmake @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/orocos-rtt-config-version.cmake DESTINATION "${CONFIG_FILE_PATH}")
# Exported targets
INSTALL(EXPORT ${LIBRARY_EXPORT_FILE} DESTINATION "${CONFIG_FILE_PATH}"
NAMESPACE "${IMPORTED_TARGET_PREFIX}")
# Package use file + helper files
INSTALL(FILES UseOROCOS-RTT.cmake UseOROCOS-RTT-helpers.cmake config/cmake_uninstall.cmake.in DESTINATION "${CONFIG_FILE_PATH}")
# Install package.xml
INSTALL(FILES package.xml DESTINATION share/rtt)
# Install an env-hook if catkin is found
find_package(catkin QUIET)
if(catkin_FOUND)
catkin_add_env_hooks(00.rtt SHELLS sh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
endif()