CMakeLists.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # CMakeLists.txt
  2. #
  3. # CMake file for the Paho C++ sample applications.
  4. #
  5. #*******************************************************************************
  6. # This is part of the Paho MQTT C++ client library.
  7. #
  8. # Copyright (c) 2016-2019
  9. #
  10. # All rights reserved. This program and the accompanying materials
  11. # are made available under the terms of the Eclipse Public License v1.0
  12. # and Eclipse Distribution License v1.0 which accompany this distribution.
  13. #
  14. # The Eclipse Public License is available at
  15. # http://www.eclipse.org/legal/epl-v10.html
  16. # and the Eclipse Distribution License is available at
  17. # http://www.eclipse.org/org/documents/edl-v10.php.
  18. #
  19. # Contributors:
  20. # Guilherme Maciel Ferreira - initial version
  21. # Frank Pagliughi - Updates for new samples
  22. #*******************************************************************************/
  23. ## Note: on OS X you should install XCode and the associated command-line tools
  24. ## --- Library dependencies ---
  25. set (THREADS_PREFER_PTHREAD_FLAG ON)
  26. find_package(Threads REQUIRED)
  27. ## include directories
  28. #include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  29. ## binary files
  30. add_executable(async_publish async_publish.cpp)
  31. add_executable(async_publish_time async_publish_time.cpp)
  32. add_executable(async_subscribe async_subscribe.cpp)
  33. add_executable(async_consume async_consume.cpp)
  34. add_executable(sync_publish sync_publish.cpp)
  35. add_executable(sync_consume sync_consume.cpp)
  36. add_executable(data_publish data_publish.cpp)
  37. add_executable(rpc_math_cli rpc_math_cli.cpp)
  38. add_executable(rpc_math_srvr rpc_math_srvr.cpp)
  39. add_executable(pub_speed_test pub_speed_test.cpp)
  40. add_executable(mqttpp_chat mqttpp_chat.cpp)
  41. add_executable(topic_publish topic_publish.cpp)
  42. ## link binaries
  43. target_link_libraries(async_publish ${PAHO_CPP_LIB})
  44. target_link_libraries(async_publish_time ${PAHO_CPP_LIB})
  45. target_link_libraries(async_subscribe ${PAHO_CPP_LIB})
  46. target_link_libraries(async_consume ${PAHO_CPP_LIB})
  47. target_link_libraries(sync_publish ${PAHO_CPP_LIB})
  48. target_link_libraries(sync_consume ${PAHO_CPP_LIB})
  49. target_link_libraries(data_publish ${PAHO_CPP_LIB})
  50. target_link_libraries(rpc_math_cli ${PAHO_CPP_LIB})
  51. target_link_libraries(rpc_math_srvr ${PAHO_CPP_LIB})
  52. target_link_libraries(mqttpp_chat ${PAHO_CPP_LIB})
  53. target_link_libraries(topic_publish ${PAHO_CPP_LIB})
  54. target_link_libraries(pub_speed_test ${PAHO_CPP_LIB})
  55. set(INSTALL_TARGETS
  56. async_publish
  57. async_publish_time
  58. async_subscribe
  59. async_consume
  60. sync_publish
  61. sync_consume
  62. data_publish
  63. rpc_math_cli
  64. rpc_math_srvr
  65. mqttpp_chat
  66. topic_publish
  67. pub_speed_test
  68. )
  69. if(PAHO_WITH_SSL)
  70. ## SSL binary files
  71. add_executable(ssl_publish ssl_publish.cpp)
  72. ## link SSL binaries
  73. target_link_libraries(ssl_publish ${PAHO_CPP_LIB})
  74. set(INSTALL_TARGETS
  75. ${INSTALL_TARGETS}
  76. ssl_publish
  77. )
  78. add_definitions(-DOPENSSL)
  79. endif()
  80. ## install binaries
  81. install(TARGETS ${INSTALL_TARGETS} EXPORT PahoMqttCppSamples
  82. RUNTIME DESTINATION bin
  83. LIBRARY DESTINATION lib
  84. )