mosquitto/lib/cpp/CMakeLists.txt

51 lines
1.5 KiB
CMake
Raw Normal View History

2014-05-07 22:27:00 +00:00
include_directories(${mosquitto_SOURCE_DIR}/lib ${mosquitto_SOURCE_DIR}/lib/cpp
${STDBOOL_H_PATH} ${STDINT_H_PATH})
link_directories(${mosquitto_BINARY_DIR}/lib)
set(C_SRC mosquittopp.cpp mosquittopp.h)
add_library(mosquittopp_obj OBJECT ${C_SRC})
set_target_properties(mosquittopp_obj PROPERTIES
POSITION_INDEPENDENT_CODE 1
)
add_library(mosquittopp SHARED $<TARGET_OBJECTS:mosquittopp_obj>)
2014-05-07 22:27:00 +00:00
target_link_libraries(mosquittopp libmosquitto)
2014-05-07 22:27:00 +00:00
set_target_properties(mosquittopp PROPERTIES
VERSION ${VERSION}
SOVERSION 1
)
install(TARGETS mosquittopp RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}")
if (${WITH_STATIC_LIBRARIES} STREQUAL ON)
if (${WITH_PIC} STREQUAL OFF)
add_library(mosquittopp_static STATIC
$<TARGET_OBJECTS:libmosquitto_obj>
${C_SRC}
)
else (${WITH_PIC} STREQUAL OFF)
add_library(mosquittopp_static STATIC
$<TARGET_OBJECTS:libmosquitto_obj>
$<TARGET_OBJECTS:mosquittopp_obj>
)
endif (${WITH_PIC} STREQUAL OFF)
target_link_libraries(mosquittopp_static ${LIBRARIES})
set_target_properties(mosquittopp_static PROPERTIES
OUTPUT_NAME mosquittopp
VERSION ${VERSION}
)
target_compile_definitions(mosquittopp_static PUBLIC "LIBMOSQUITTO_STATIC")
2016-06-21 22:33:58 +00:00
install(TARGETS mosquittopp_static RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}")
endif (${WITH_STATIC_LIBRARIES} STREQUAL ON)
install(FILES mosquittopp.h DESTINATION "${INCLUDEDIR}")
2014-05-07 22:27:00 +00:00
if (UNIX AND NOT APPLE)
2014-05-07 22:27:00 +00:00
install(CODE "EXEC_PROGRAM(/sbin/ldconfig)")
endif (UNIX AND NOT APPLE)