mirror of https://github.com/microsoft/vcpkg.git
148 lines
5.0 KiB
Diff
148 lines
5.0 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 9e1c58d..6fa9392 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -71,7 +71,7 @@ option(WITH_PIC "Build the static library with PIC (Position Independent Code) e
|
|
option(WITH_THREADING "Include client library threading support?" ON)
|
|
if (WITH_THREADING)
|
|
add_definitions("-DWITH_THREADING")
|
|
- if(WIN32)
|
|
+ if(WIN32 AND NOT MINGW)
|
|
find_package(Pthreads4W REQUIRED)
|
|
endif()
|
|
endif (WITH_THREADING)
|
|
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
|
index 21b6149..051dffe 100644
|
|
--- a/lib/CMakeLists.txt
|
|
+++ b/lib/CMakeLists.txt
|
|
@@ -60,7 +60,7 @@ set(C_SRC
|
|
util_mosq.c util_topic.c util_mosq.h
|
|
will_mosq.c will_mosq.h)
|
|
|
|
-set (LIBRARIES OpenSSL::SSL)
|
|
+set (LIBRARIES PRIVATE OpenSSL::SSL)
|
|
|
|
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
|
find_library(LIBRT rt)
|
|
@@ -90,7 +90,7 @@ set_target_properties(libmosquitto PROPERTIES
|
|
)
|
|
|
|
if (WITH_THREADING)
|
|
- if(WIN32)
|
|
+ if(WIN32 AND NOT MINGW)
|
|
set (LIBRARIES ${LIBRARIES} PThreads4W::PThreads4W)
|
|
else()
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
@@ -115,11 +115,6 @@ if(UNIX AND NOT APPLE)
|
|
)
|
|
endif()
|
|
|
|
-install(TARGETS libmosquitto
|
|
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
-
|
|
if (WITH_STATIC_LIBRARIES)
|
|
add_library(libmosquitto_static STATIC ${C_SRC})
|
|
if (WITH_PIC)
|
|
@@ -136,8 +131,28 @@ if (WITH_STATIC_LIBRARIES)
|
|
)
|
|
|
|
target_compile_definitions(libmosquitto_static PUBLIC "LIBMOSQUITTO_STATIC")
|
|
- install(TARGETS libmosquitto_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
+
|
|
+ set(install_target libmosquitto_static)
|
|
+ set_target_properties(libmosquitto PROPERTIES EXCLUDE_FROM_ALL 1)
|
|
+else ()
|
|
+ set(install_target libmosquitto)
|
|
endif (WITH_STATIC_LIBRARIES)
|
|
|
|
+target_include_directories(${install_target} PUBLIC $<INSTALL_INTERFACE:include>)
|
|
+set_target_properties(${install_target} PROPERTIES EXPORT_NAME mosquitto)
|
|
+install(TARGETS ${install_target}
|
|
+ EXPORT mosquitto
|
|
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
+)
|
|
+install(EXPORT mosquitto
|
|
+ NAMESPACE unofficial::mosquitto::
|
|
+ FILE unofficial-mosquitto-targets.cmake
|
|
+ DESTINATION "share/unofficial-mosquitto"
|
|
+)
|
|
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/unofficial-mosquitto-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-mosquitto-config.cmake" @ONLY)
|
|
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-mosquitto-config.cmake" DESTINATION "share/unofficial-mosquitto")
|
|
+
|
|
install(FILES ../include/mosquitto.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
install(FILES ../include/mqtt_protocol.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt
|
|
index 882b662..5959a96 100644
|
|
--- a/lib/cpp/CMakeLists.txt
|
|
+++ b/lib/cpp/CMakeLists.txt
|
|
@@ -9,15 +9,11 @@ add_library(mosquittopp SHARED ${CPP_SRC})
|
|
set_target_properties(mosquittopp PROPERTIES
|
|
POSITION_INDEPENDENT_CODE 1
|
|
)
|
|
-target_link_libraries(mosquittopp libmosquitto)
|
|
+target_link_libraries(mosquittopp PUBLIC libmosquitto)
|
|
set_target_properties(mosquittopp PROPERTIES
|
|
VERSION ${VERSION}
|
|
SOVERSION 1
|
|
)
|
|
-install(TARGETS mosquittopp
|
|
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
if (WITH_STATIC_LIBRARIES)
|
|
add_library(mosquittopp_static STATIC
|
|
@@ -30,7 +26,7 @@ if (WITH_STATIC_LIBRARIES)
|
|
)
|
|
endif (WITH_PIC)
|
|
|
|
- target_link_libraries(mosquittopp_static ${LIBRARIES})
|
|
+ target_link_libraries(mosquittopp_static PUBLIC libmosquitto_static)
|
|
|
|
set_target_properties(mosquittopp_static PROPERTIES
|
|
OUTPUT_NAME mosquittopp_static
|
|
@@ -38,7 +34,19 @@ if (WITH_STATIC_LIBRARIES)
|
|
)
|
|
|
|
target_compile_definitions(mosquittopp_static PUBLIC "LIBMOSQUITTO_STATIC")
|
|
- install(TARGETS mosquittopp_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
+
|
|
+ set(install_target mosquittopp_static)
|
|
+ set_target_properties(mosquittopp PROPERTIES EXCLUDE_FROM_ALL 1)
|
|
+else ()
|
|
+ set(install_target mosquittopp)
|
|
endif (WITH_STATIC_LIBRARIES)
|
|
|
|
+set_target_properties(${install_target} PROPERTIES EXPORT_NAME mosquittopp)
|
|
+install(TARGETS ${install_target}
|
|
+ EXPORT mosquitto
|
|
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
+)
|
|
+
|
|
install(FILES mosquittopp.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
diff --git a/libmosquitto.pc.in b/libmosquitto.pc.in
|
|
index 101a125..0747b43 100644
|
|
--- a/libmosquitto.pc.in
|
|
+++ b/libmosquitto.pc.in
|
|
@@ -8,3 +8,5 @@ Description: mosquitto MQTT library (C bindings)
|
|
Version: @VERSION@
|
|
Cflags: -I${includedir}
|
|
Libs: -L${libdir} -lmosquitto
|
|
+Libs.private: @CMAKE_THREAD_LIBS_INIT@
|
|
+Requires.private: libssl
|
|
diff --git a/libmosquittopp.pc.in b/libmosquittopp.pc.in
|
|
index 6070f44..4edde61 100644
|
|
--- a/libmosquittopp.pc.in
|
|
+++ b/libmosquittopp.pc.in
|
|
@@ -8,3 +8,4 @@ Description: mosquitto MQTT library (C++ bindings)
|
|
Version: @VERSION@
|
|
Cflags: -I${includedir}
|
|
Libs: -L${libdir} -lmosquittopp
|
|
+Requires.private: libmosquitto
|