@ -1,4 +1,5 @@
option ( BUILD_STATIC_LIBRARY "Build the static library?" ON )
option ( BUILD_STATIC_LIBRARY "Build the static library?" ON )
option ( WITH_PIC "Build the static library with PIC(Position Independent Code) enabled archives?" OFF )
add_subdirectory ( cpp )
add_subdirectory ( cpp )
option ( WITH_THREADING "Include client library threading support?" ON )
option ( WITH_THREADING "Include client library threading support?" ON )
@ -80,7 +81,12 @@ if (${WITH_SRV} STREQUAL ON)
endif ( ARES_HEADER )
endif ( ARES_HEADER )
endif ( ${ WITH_SRV } STREQUAL ON )
endif ( ${ WITH_SRV } STREQUAL ON )
add_library ( libmosquitto SHARED ${ C_SRC } )
add_library ( libmosquitto_obj OBJECT ${ C_SRC } )
set_target_properties ( libmosquitto_obj PROPERTIES
P O S I T I O N _ I N D E P E N D E N T _ C O D E 1
)
add_library ( libmosquitto SHARED $< TARGET_OBJECTS:libmosquitto_obj > )
target_link_libraries ( libmosquitto ${ LIBRARIES } )
target_link_libraries ( libmosquitto ${ LIBRARIES } )
@ -93,8 +99,11 @@ set_target_properties(libmosquitto PROPERTIES
install ( TARGETS libmosquitto RUNTIME DESTINATION ${ BINDIR } LIBRARY DESTINATION ${ LIBDIR } )
install ( TARGETS libmosquitto RUNTIME DESTINATION ${ BINDIR } LIBRARY DESTINATION ${ LIBDIR } )
if ( ${ BUILD_STATIC_LIBRARY } STREQUAL ON )
if ( ${ BUILD_STATIC_LIBRARY } STREQUAL ON )
# t a r g e t f o r b u i l d i n g s t a t i c v e r s i o n o f l i b r a r y
if ( ${ WITH_PIC } STREQUAL OFF )
add_library ( libmosquitto_static STATIC ${ C_SRC } )
add_library ( libmosquitto_static STATIC ${ C_SRC } )
else ( ${ WITH_PIC } STREQUAL OFF )
add_library ( libmosquitto_static STATIC $< TARGET_OBJECTS:libmosquitto_obj > )
endif ( ${ WITH_PIC } STREQUAL OFF )
target_link_libraries ( libmosquitto_static ${ LIBRARIES } )
target_link_libraries ( libmosquitto_static ${ LIBRARIES } )