-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
61 lines (50 loc) · 1.42 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
cmake_minimum_required(VERSION 3.8)
project(epos2_motor_controller VERSION 1.0.3)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH}
)
# FIND PACKAGE FTDI
# - FTDI_FOUND
# - FTDI_INCLUDE_DIRS
# - FTDI_LIBRARIES
find_package(FTDI REQUIRED)
add_library(epos2 src/Epos2.cpp)
target_link_libraries(epos2
${FTDI_LIBRARIES}
)
target_include_directories(epos2 PUBLIC ${FTDI_INCLUDE_DIRS})
target_include_directories(epos2
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
# Install includes
install(
DIRECTORY include/
DESTINATION include
)
# Install lib
install(
TARGETS epos2
EXPORT epos2Targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
find_package(ament_cmake QUIET)
if(ament_cmake_FOUND)
# Export external dependency to libftdi to make sure that
# packages that depend on this are able to find our custom
# cmake script for libftdi in their cmake scripts
ament_export_dependencies(FTDI)
# Signal that the package build its own library
ament_export_targets(epos2Targets HAS_LIBRARY_TARGET)
# Package everything including our custom cmake script
ament_package(CONFIG_EXTRAS cmake/FindFTDI.cmake)
endif(ament_cmake_FOUND)