CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. include_directories(${mosquitto_SOURCE_DIR}/lib ${mosquitto_SOURCE_DIR}/lib/cpp
  2. ${mosquitto_SOURCE_DIR}/include
  3. ${STDBOOL_H_PATH} ${STDINT_H_PATH})
  4. link_directories(${mosquitto_BINARY_DIR}/lib)
  5. set(CPP_SRC mosquittopp.cpp mosquittopp.h)
  6. add_library(mosquittopp SHARED ${CPP_SRC})
  7. set_target_properties(mosquittopp PROPERTIES
  8. POSITION_INDEPENDENT_CODE 1
  9. )
  10. target_link_libraries(mosquittopp libmosquitto)
  11. set_target_properties(mosquittopp PROPERTIES
  12. VERSION ${VERSION}
  13. SOVERSION 1
  14. )
  15. install(TARGETS mosquittopp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
  16. if (WITH_STATIC_LIBRARIES)
  17. add_library(mosquittopp_static STATIC
  18. ${C_SRC}
  19. ${CPP_SRC}
  20. )
  21. if (WITH_PIC)
  22. set_target_properties(mosquittopp_static PROPERTIES
  23. POSITION_INDEPENDENT_CODE 1
  24. )
  25. endif (WITH_PIC)
  26. target_link_libraries(mosquittopp_static ${LIBRARIES})
  27. set_target_properties(mosquittopp_static PROPERTIES
  28. OUTPUT_NAME mosquittopp_static
  29. VERSION ${VERSION}
  30. )
  31. target_compile_definitions(mosquittopp_static PUBLIC "LIBMOSQUITTO_STATIC")
  32. install(TARGETS mosquittopp_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
  33. endif (WITH_STATIC_LIBRARIES)
  34. install(FILES mosquittopp.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")