-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
77 lines (56 loc) · 2.07 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
cmake_minimum_required(VERSION 2.8)
project(vescuart)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
find_package(Boost REQUIRED COMPONENTS
system
thread)
###########
# library #
###########
set(VESCUART_SOURCES
src/Vesc.cpp
src/VescMessage.cpp
src/VescMotor.cpp
)
include_directories(include
${Boost_INCLUDE_DIRS})
add_library(vescuart SHARED ${VESCUART_SOURCES})
target_link_libraries(vescuart
${Boost_LIBRARIES})
add_library(vescuart_static STATIC ${VESCUART_SOURCES})
target_link_libraries(vescuart_static
${Boost_LIBRARIES})
###################
# install library #
###################
install(TARGETS vescuart
EXPORT vescuartTargets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)
install(DIRECTORY include/vescuart
DESTINATION include ${CMAKE_INSTALL_INCLUDEDIR})
#######################
# install cmake stuff #
#######################
include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR include/)
set(LIB_INSTALL_DIR lib/)
set(SYSCONFIG_INSTALL_DIR etc/vescuart/)
install(EXPORT vescuartTargets
FILE vescuartTargets.cmake
NAMESPACE vescuart::
DESTINATION ${LIB_INSTALL_DIR}/cmake/vescuart)
configure_package_config_file(VescuartConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/VescuartConfig.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/vescuart
PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/VescuartConfigVersion.cmake
COMPATIBILITY SameMajorVersion
VERSION 0.0.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VescuartConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/VescuartConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/cmake/vescuart)