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

Merge 06971e07f80ff79e0b2516518ecdaa8bbedd2cc0 into d3713af096bdfdc1709e57e0066949314b7db1a6

This commit is contained in:
Emil Fresk 2018-01-13 20:05:33 +00:00 committed by GitHub
commit d0780e071a

View File

@ -2,26 +2,28 @@ cmake_minimum_required(VERSION 2.8.3)
project(serial) project(serial)
# Find catkin # Find catkin
find_package(catkin REQUIRED) find_package(catkin QUIET)
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 (catkin_FOUND)
# If Linux, add rt and pthread if(UNIX AND NOT APPLE)
catkin_package( # If Linux, add rt and pthread
LIBRARIES ${PROJECT_NAME} catkin_package(
INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME}
DEPENDS rt pthread INCLUDE_DIRS include
) DEPENDS rt pthread
else() )
# Otherwise normal call else()
catkin_package( # Otherwise normal call
LIBRARIES ${PROJECT_NAME} catkin_package(
INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME}
) INCLUDE_DIRS include
)
endif()
endif() endif()
## Sources ## Sources
@ -63,16 +65,30 @@ target_link_libraries(serial_example ${PROJECT_NAME})
include_directories(include) include_directories(include)
## Install executable ## Install executable
install(TARGETS ${PROJECT_NAME} if (catkin_FOUND)
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
) LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
else()
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)
endif()
## Install headers ## Install headers
install(FILES include/serial/serial.h include/serial/v8stdint.h if (catkin_FOUND)
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial) install(FILES include/serial/serial.h include/serial/v8stdint.h
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
else()
install(FILES include/serial/serial.h include/serial/v8stdint.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/serial)
endif()
## Tests ## Tests
if(CATKIN_ENABLE_TESTING) if (catkin_FOUND)
add_subdirectory(tests) if(CATKIN_ENABLE_TESTING)
add_subdirectory(tests)
endif()
endif() endif()