1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

Merge 50f4f2bc6eca1194df6c21f39fd31837064f3cca into 827c4a784dd4fdd35dc391f37ef152eab7c9c9b2

This commit is contained in:
José Manuel Díez 2017-01-31 13:00:04 +00:00 committed by GitHub
commit 742f879a4b

View File

@ -1,29 +1,13 @@
cmake_minimum_required(VERSION 2.8.3)
project(serial)
# Find catkin
find_package(catkin REQUIRED)
option(USE_CATKIN "Use Catkin for packaging" ON)
if(APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation)
endif()
if(UNIX AND NOT APPLE)
# If Linux, add rt and pthread
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS rt pthread
)
else()
# Otherwise normal call
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
)
endif()
## Sources
set(serial_SRCS
src/serial.cc
@ -62,6 +46,25 @@ target_link_libraries(serial_example ${PROJECT_NAME})
## Include headers
include_directories(include)
if(USE_CATKIN)
# Find catkin
find_package(catkin REQUIRED)
if(UNIX AND NOT APPLE)
# If Linux, add rt and pthread
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
DEPENDS rt pthread
)
else()
# Otherwise normal call
catkin_package(
LIBRARIES ${PROJECT_NAME}
INCLUDE_DIRS include
)
endif()
## Install executable
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
@ -76,3 +79,14 @@ install(FILES include/serial/serial.h include/serial/v8stdint.h
if(CATKIN_ENABLE_TESTING)
add_subdirectory(tests)
endif()
else()
## Install executable
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
## Install headers
install(FILES include/serial/serial.h include/serial/v8stdint.h
DESTINATION include/serial)
endif()