CMakeLists.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(mqtt_socket)
  3. find_package(autoware_build_flags REQUIRED)
  4. find_package(catkin REQUIRED COMPONENTS
  5. autoware_can_msgs
  6. autoware_msgs
  7. roscpp
  8. roslib
  9. std_msgs
  10. tablet_socket_msgs
  11. )
  12. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
  13. find_package(Mosquitto REQUIRED)
  14. find_package(yaml-cpp REQUIRED)
  15. catkin_package()
  16. if(MOSQUITTO_FOUND)
  17. set(CMAKE_CXX_FLAGS "-O2 -Wall -fpermissive ${CMAKE_CXX_FLAGS}")
  18. include_directories(
  19. include
  20. ${catkin_INCLUDE_DIRS}
  21. ${MOSQUITTO_INCLUDE_DIRS}
  22. ${YAML_CPP_INCLUDE_DIR}
  23. )
  24. add_executable(mqtt_sender nodes/mqtt_sender/mqtt_sender.cpp)
  25. target_link_libraries(mqtt_sender ${MOSQUITTO_LIBRARIES} yaml-cpp ${catkin_LIBRARIES})
  26. add_dependencies(mqtt_sender ${catkin_EXPORTED_TARGETS})
  27. add_executable(mqtt_receiver nodes/mqtt_receiver/mqtt_receiver.cpp)
  28. target_link_libraries(mqtt_receiver ${MOSQUITTO_LIBRARIES} yaml-cpp ${catkin_LIBRARIES})
  29. add_dependencies(mqtt_receiver ${catkin_EXPORTED_TARGETS})
  30. install(TARGETS mqtt_receiver mqtt_sender
  31. ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  32. LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  33. RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  34. )
  35. else()
  36. message("'libmosquitto-dev' is not installed. 'mqtt_sender' and 'mqtt_receiver' will not be built.")
  37. endif()