-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
71 lines (59 loc) · 2.17 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
cmake_minimum_required(VERSION 3.0)
# Project name
project(gap VERSION 1.5.0)
message (STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}")
string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
# Additional cmake modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# CMake safeguards e.g. prevent in-source builds
include(safeguards)
# Check dependencies
find_package(Boost COMPONENTS system REQUIRED)
find_package(gazebo REQUIRED)
find_package(Protobuf REQUIRED)
# Setup directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
# [project]-[major].[minor] String
set (project_major_minor
"${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
# Setup directories for library installation
set (msgs_include_dest "include/${project_major_minor}")
set (msgs_lib_dest "lib/${project_major_minor}")
# Setup directories for plugin installation
set (plugins_lib_dest "lib/${project_major_minor}")
# Setup directories for utils installation
set (utils_include_dest "include/${project_major_minor}")
set (utils_lib_dest "lib/${project_major_minor}")
# Add uninstall command
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake"
)
# Build project
# Messages
add_subdirectory(msgs)
# Plugins
add_subdirectory(plugins)
# Utilities
add_subdirectory(utils)
# Examples
add_subdirectory(examples)
# Documentation
add_subdirectory(doc)
# Configuration file
set(PKG_NAME ${PROJECT_NAME_UPPER})
set(cmake_conf_file "cmake/gap-config.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${cmake_conf_file}.in"
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}" @ONLY)
# Version control
set(cmake_version_file "cmake/gap-config-version.cmake")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${cmake_version_file}.in"
"${CMAKE_CURRENT_BINARY_DIR}/${cmake_version_file}" @ONLY)
# Create package
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}
${CMAKE_CURRENT_BINARY_DIR}/${cmake_version_file}
DESTINATION ${msgs_lib_dest}/
COMPONENT cmake)