-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (78 loc) · 1.8 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
cmake_minimum_required(VERSION 3.5)
project(hardware_communication_lib)
#option(HWCOMLIB_BUILD_SHARED_LIBS "build as a shared library" ON)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
#find_package(rclcpp REQUIRED)
#find_package(std_msgs REQUIRED)
#Build UDPCOM
#if( HWCOMLIB_BUILD_SHARED_LIBS )
add_library(udpcom SHARED
src/udp_recv.cc
src/udp_send.cc
)
add_library(serialcom SHARED
src/serialcom.cc
)
#else()
# add_library(udpcom STATIC
# src/udp_recv.cc
# src/udp_send.cc
# )
# add_library(serialcom STATIC
# src/serialcom.cc
# )
#endif()
target_compile_definitions(udpcom
PRIVATE "UDPCOM_BUILDING_LIBRARY"
)
target_compile_definitions(serialcom
PRIVATE "SERIALCOM_BUILDING_LIBRARY"
)
ament_target_dependencies(udpcom
#None
)
ament_target_dependencies(serialcom
#None
)
target_include_directories(udpcom
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(serialcom
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if(NOT WIN32)
ament_environment_hooks(
"${ament_cmake_package_templates_ENVIRONMENT_HOOK_LIBRARY_PATH}"
)
endif()
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
install(
DIRECTORY include/
DESTINATION include
)
install(
TARGETS udpcom serialcom
#TARGETS serialcom
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
ament_package()