CMakeLists.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. set(shared_src client_shared.c client_shared.h client_props.c)
  2. if (WITH_SRV)
  3. add_definitions("-DWITH_SRV")
  4. endif (WITH_SRV)
  5. set( CLIENT_INC ${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/include
  6. ${STDBOOL_H_PATH} ${STDINT_H_PATH} ${PTHREAD_INCLUDE_DIR}
  7. ${OPENSSL_INCLUDE_DIR})
  8. set( CLIENT_DIR ${mosquitto_BINARY_DIR}/lib)
  9. if (CJSON_FOUND)
  10. add_definitions("-DWITH_CJSON")
  11. set( CLIENT_DIR "${CLIENT_DIR};${CJSON_DIR}" )
  12. set( CLIENT_INC "${CLIENT_INC};${CJSON_INCLUDE_DIRS}" )
  13. endif()
  14. include_directories(${CLIENT_INC})
  15. link_directories(${CLIENT_DIR})
  16. add_executable(mosquitto_pub pub_client.c pub_shared.c ${shared_src})
  17. add_executable(mosquitto_sub sub_client.c sub_client_output.c ${shared_src})
  18. add_executable(mosquitto_rr rr_client.c pub_shared.c sub_client_output.c ${shared_src})
  19. if (CJSON_FOUND)
  20. target_link_libraries(mosquitto_pub ${CJSON_LIBRARIES})
  21. target_link_libraries(mosquitto_sub ${CJSON_LIBRARIES})
  22. target_link_libraries(mosquitto_rr ${CJSON_LIBRARIES})
  23. endif()
  24. if (WITH_STATIC_LIBRARIES)
  25. target_link_libraries(mosquitto_pub libmosquitto_static)
  26. target_link_libraries(mosquitto_sub libmosquitto_static)
  27. target_link_libraries(mosquitto_rr libmosquitto_static)
  28. else()
  29. target_link_libraries(mosquitto_pub libmosquitto)
  30. target_link_libraries(mosquitto_sub libmosquitto)
  31. target_link_libraries(mosquitto_rr libmosquitto)
  32. endif()
  33. if (QNX)
  34. target_link_libraries(mosquitto_pub socket)
  35. target_link_libraries(mosquitto_sub socket)
  36. target_link_libraries(mosquitto_rr socket)
  37. endif()
  38. install(TARGETS mosquitto_pub RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
  39. install(TARGETS mosquitto_sub RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
  40. install(TARGETS mosquitto_rr RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")