mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Merge 50f4f2bc6eca1194df6c21f39fd31837064f3cca into 827c4a784dd4fdd35dc391f37ef152eab7c9c9b2
This commit is contained in:
commit
742f879a4b
@ -1,29 +1,13 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.3)
|
cmake_minimum_required(VERSION 2.8.3)
|
||||||
project(serial)
|
project(serial)
|
||||||
|
|
||||||
# Find catkin
|
option(USE_CATKIN "Use Catkin for packaging" ON)
|
||||||
find_package(catkin REQUIRED)
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(IOKIT_LIBRARY IOKit)
|
find_library(IOKIT_LIBRARY IOKit)
|
||||||
find_library(FOUNDATION_LIBRARY Foundation)
|
find_library(FOUNDATION_LIBRARY Foundation)
|
||||||
endif()
|
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
|
## Sources
|
||||||
set(serial_SRCS
|
set(serial_SRCS
|
||||||
src/serial.cc
|
src/serial.cc
|
||||||
@ -62,17 +46,47 @@ target_link_libraries(serial_example ${PROJECT_NAME})
|
|||||||
## Include headers
|
## Include headers
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|
||||||
## Install executable
|
if(USE_CATKIN)
|
||||||
install(TARGETS ${PROJECT_NAME}
|
# 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}
|
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
)
|
)
|
||||||
|
|
||||||
## Install headers
|
## Install headers
|
||||||
install(FILES include/serial/serial.h include/serial/v8stdint.h
|
install(FILES include/serial/serial.h include/serial/v8stdint.h
|
||||||
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
|
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
if(CATKIN_ENABLE_TESTING)
|
if(CATKIN_ENABLE_TESTING)
|
||||||
add_subdirectory(tests)
|
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()
|
endif()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user