CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(ros_observer)
  3. add_compile_options(-std=c++11)
  4. find_package(
  5. catkin REQUIRED COMPONENTS
  6. roscpp
  7. roslint
  8. )
  9. find_package(Boost REQUIRED COMPONENTS
  10. thread
  11. )
  12. set(ROSLINT_CPP_OPTS "--filter=-build/c++11")
  13. roslint_cpp()
  14. catkin_package(
  15. INCLUDE_DIRS include
  16. LIBRARIES lib_ros_observer
  17. )
  18. include_directories(
  19. include
  20. ${catkin_INCLUDE_DIRS}
  21. )
  22. add_executable(
  23. ros_observer
  24. src/ros_observer.cpp
  25. )
  26. target_link_libraries(
  27. ros_observer
  28. rt ${Boost_LIBRARIES}
  29. )
  30. add_dependencies(
  31. ros_observer
  32. ${catkin_EXPORTED_TARGETS}
  33. )
  34. add_library(
  35. lib_ros_observer
  36. lib/lib_ros_observer.cpp
  37. )
  38. target_link_libraries(
  39. lib_ros_observer
  40. ${catkin_LIBRARIES}
  41. rt
  42. ${Boost_LIBRARIES}
  43. )
  44. add_dependencies(
  45. lib_ros_observer
  46. ${catkin_EXPORTED_TARGETS}
  47. )
  48. # include header files
  49. install(DIRECTORY include/${PROJECT_NAME}/
  50. DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  51. )
  52. # Install library
  53. install(TARGETS ros_observer lib_ros_observer
  54. ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  55. LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  56. RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  57. )
  58. # Install launch
  59. install(DIRECTORY launch/
  60. DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
  61. )
  62. if (CATKIN_ENABLE_TESTING)
  63. roslint_add_test()
  64. find_package(rostest REQUIRED)
  65. add_rostest_gtest(test_ros_observer
  66. test/test_ros_observer.test
  67. test/src/test_ros_observer.cpp
  68. )
  69. target_link_libraries(test_ros_observer
  70. lib_ros_observer
  71. ${catkin_LIBRARIES}
  72. )
  73. endif()