forked from b-it-bots/kelo-motion-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (82 loc) · 2.98 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
cmake_minimum_required(VERSION 3.15)
project(kelo_motion_control VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INSTALL_DIR share/${PROJECT_NAME}/cmake)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/../build/)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/../build/)
LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib/)
find_package(kelo_platform REQUIRED)
list(APPEND local_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/)
include_directories(
include
${local_INCLUDE_DIRS}
)
add_library(kelo_motion_control SHARED
src/KELORobotKinematics.c
src/SmartWheelKinematics.c
src/PlatformToWheelSolver.c
src/KeloMotionControl.c
)
target_include_directories(kelo_motion_control PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(kelo_motion_control
gsl
gslcblas
m
)
install(
TARGETS kelo_motion_control
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# Generate the CMake config file
include(CMakePackageConfigHelpers)
# Generate the version file accompanying the project's config file
configure_package_config_file(${PROJECT_NAME}-config.cmake.in
${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR})
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
# Install the config and configversion
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_DIR})
# Make the targets accessible from this packages's build tree
export(
EXPORT ${PROJECT_NAME}-targets
NAMESPACE ${PROJECT_NAME}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake"
)
# Make the targets accessible from this packages's install tree
install(
EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_DIR})
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
add_subdirectory(src/example)
# add all cpp files in the test directory as test sources
# file(GLOB test_sources
# test/*.c
# test/*.cpp
# )
# make executables
# foreach(source ${test_sources})
# message(STATUS "Adding test: ${source}")
# get_filename_component(name ${source} NAME_WE)
# add_executable(${name} ${source})
# target_link_libraries(${name} ${PROJECT_NAME} soem pthread gsl gslcblas m)
# set_target_properties(${name} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
# install(TARGETS ${name} RUNTIME DESTINATION bin)
# endforeach(source ${test_sources})