[48] | 1 | cmake_minimum_required(VERSION 2.8.3) |
---|
| 2 | project(shared_serial) |
---|
| 3 | |
---|
| 4 | ## Find catkin macros and libraries |
---|
| 5 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) |
---|
| 6 | ## is used, also find other catkin packages |
---|
| 7 | find_package(catkin REQUIRED COMPONENTS roscpp message_generation) |
---|
| 8 | |
---|
| 9 | ####################################### |
---|
| 10 | ## Declare ROS messages and services ## |
---|
| 11 | ####################################### |
---|
| 12 | |
---|
| 13 | ## Generate messages in the 'msg' folder |
---|
| 14 | add_message_files( |
---|
| 15 | DIRECTORY msg |
---|
| 16 | ) |
---|
| 17 | |
---|
| 18 | ## Generate services in the 'srv' folder |
---|
| 19 | add_service_files( |
---|
| 20 | DIRECTORY srv |
---|
| 21 | ) |
---|
| 22 | |
---|
| 23 | ## Generate added messages and services with any dependencies listed here |
---|
| 24 | generate_messages() |
---|
| 25 | |
---|
| 26 | ################################### |
---|
| 27 | ## catkin specific configuration ## |
---|
| 28 | ################################### |
---|
| 29 | ## The catkin_package macro generates cmake config files for your package |
---|
| 30 | ## Declare things to be passed to dependent projects |
---|
| 31 | ## INCLUDE_DIRS: uncomment this if you package contains header files |
---|
| 32 | ## LIBRARIES: libraries you create in this project that dependent projects also need |
---|
| 33 | ## CATKIN_DEPENDS: catkin_packages dependent projects also need |
---|
| 34 | ## DEPENDS: system dependencies of this project that dependent projects also need |
---|
| 35 | catkin_package( |
---|
| 36 | INCLUDE_DIRS include |
---|
| 37 | LIBRARIES ${PROJECT_NAME} |
---|
| 38 | CATKIN_DEPENDS roscpp message_runtime |
---|
| 39 | ) |
---|
| 40 | |
---|
| 41 | ########### |
---|
| 42 | ## Build ## |
---|
| 43 | ########### |
---|
| 44 | |
---|
| 45 | ## Specify additional locations of header files |
---|
| 46 | ## Your package locations should be listed before other locations |
---|
| 47 | # include_directories(include) |
---|
| 48 | include_directories( |
---|
| 49 | include ${catkin_INCLUDE_DIRS} |
---|
| 50 | ) |
---|
| 51 | |
---|
| 52 | ## Declare a cpp library |
---|
| 53 | add_library(${PROJECT_NAME} |
---|
| 54 | src/client.cpp |
---|
| 55 | ) |
---|
| 56 | |
---|
| 57 | ## Declare a cpp executable |
---|
| 58 | add_executable(server src/server.cpp src/watchdog.cpp src/LxSerial.cpp) |
---|
| 59 | |
---|
| 60 | ## Add cmake target dependencies of the executable/library |
---|
| 61 | ## as an example, message headers may need to be generated before nodes |
---|
| 62 | add_dependencies(${PROJECT_NAME} shared_serial_generate_messages_cpp) |
---|
| 63 | add_dependencies(server shared_serial_generate_messages_cpp) |
---|
| 64 | |
---|
| 65 | target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) |
---|
| 66 | target_link_libraries(server ${catkin_LIBRARIES} pthread) |
---|
| 67 | |
---|
| 68 | ############# |
---|
| 69 | ## Install ## |
---|
| 70 | ############# |
---|
| 71 | |
---|
| 72 | ## Mark executables and/or libraries for installation |
---|
| 73 | install(TARGETS ${PROJECT_NAME} server |
---|
| 74 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
---|
| 75 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
---|
| 76 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
---|
| 77 | ) |
---|
| 78 | |
---|
| 79 | ## Mark cpp header files for installation |
---|
| 80 | install(FILES include/${PROJECT_NAME}/client.h |
---|
| 81 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
---|
| 82 | ) |
---|