mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 20:23:02 +08:00
[paho-mqtt]Fix static build: dynamic libraries should not be built.
This commit is contained in:
parent
7368463563
commit
ace00e09d1
97
ports/paho-mqtt/fix-static-build.patch
Normal file
97
ports/paho-mqtt/fix-static-build.patch
Normal file
@ -0,0 +1,97 @@
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 14b94b1..508c5b1 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -65,28 +65,29 @@ ENDIF()
|
||||
ADD_LIBRARY(common_obj OBJECT ${common_src})
|
||||
SET_PROPERTY(TARGET common_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
-ADD_EXECUTABLE(MQTTVersion MQTTVersion.c)
|
||||
-
|
||||
-ADD_LIBRARY(paho-mqtt3c SHARED $<TARGET_OBJECTS:common_obj> MQTTClient.c)
|
||||
-ADD_LIBRARY(paho-mqtt3a SHARED $<TARGET_OBJECTS:common_obj> MQTTAsync.c)
|
||||
-
|
||||
-TARGET_LINK_LIBRARIES(paho-mqtt3c ${LIBS_SYSTEM})
|
||||
-TARGET_LINK_LIBRARIES(paho-mqtt3a ${LIBS_SYSTEM})
|
||||
-
|
||||
-TARGET_LINK_LIBRARIES(MQTTVersion paho-mqtt3a paho-mqtt3c ${LIBS_SYSTEM})
|
||||
-SET_TARGET_PROPERTIES(
|
||||
- paho-mqtt3c paho-mqtt3a PROPERTIES
|
||||
- VERSION ${CLIENT_VERSION}
|
||||
- SOVERSION ${PAHO_VERSION_MAJOR})
|
||||
-
|
||||
-INSTALL(TARGETS paho-mqtt3c paho-mqtt3a
|
||||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
-INSTALL(TARGETS MQTTVersion
|
||||
- RUNTIME DESTINATION tools/paho-mqtt)
|
||||
-
|
||||
-IF (PAHO_BUILD_STATIC)
|
||||
+IF (NOT PAHO_BUILD_STATIC)
|
||||
+ ADD_EXECUTABLE(MQTTVersion MQTTVersion.c)
|
||||
+
|
||||
+ ADD_LIBRARY(paho-mqtt3c SHARED $<TARGET_OBJECTS:common_obj> MQTTClient.c)
|
||||
+ ADD_LIBRARY(paho-mqtt3a SHARED $<TARGET_OBJECTS:common_obj> MQTTAsync.c)
|
||||
+
|
||||
+ TARGET_LINK_LIBRARIES(paho-mqtt3c ${LIBS_SYSTEM})
|
||||
+ TARGET_LINK_LIBRARIES(paho-mqtt3a ${LIBS_SYSTEM})
|
||||
+
|
||||
+ TARGET_LINK_LIBRARIES(MQTTVersion paho-mqtt3a paho-mqtt3c ${LIBS_SYSTEM})
|
||||
+ SET_TARGET_PROPERTIES(
|
||||
+ paho-mqtt3c paho-mqtt3a PROPERTIES
|
||||
+ VERSION ${CLIENT_VERSION}
|
||||
+ SOVERSION ${PAHO_VERSION_MAJOR})
|
||||
+
|
||||
+ INSTALL(TARGETS paho-mqtt3c paho-mqtt3a
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
+ INSTALL(TARGETS MQTTVersion
|
||||
+ RUNTIME DESTINATION tools/paho-mqtt)
|
||||
+ELSE()
|
||||
+ message("Build as static library")
|
||||
ADD_LIBRARY(paho-mqtt3c-static STATIC $<TARGET_OBJECTS:common_obj> MQTTClient.c)
|
||||
ADD_LIBRARY(paho-mqtt3a-static STATIC $<TARGET_OBJECTS:common_obj> MQTTAsync.c)
|
||||
|
||||
@@ -132,22 +133,24 @@ IF (PAHO_WITH_SSL)
|
||||
ADD_LIBRARY(common_ssl_obj OBJECT ${common_src})
|
||||
SET_PROPERTY(TARGET common_ssl_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
SET_PROPERTY(TARGET common_ssl_obj PROPERTY COMPILE_DEFINITIONS "OPENSSL=1")
|
||||
- ADD_LIBRARY(paho-mqtt3cs SHARED $<TARGET_OBJECTS:common_ssl_obj> MQTTClient.c SSLSocket.c)
|
||||
- ADD_LIBRARY(paho-mqtt3as SHARED $<TARGET_OBJECTS:common_ssl_obj> MQTTAsync.c SSLSocket.c)
|
||||
-
|
||||
- TARGET_LINK_LIBRARIES(paho-mqtt3cs ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM})
|
||||
- TARGET_LINK_LIBRARIES(paho-mqtt3as ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM})
|
||||
- SET_TARGET_PROPERTIES(
|
||||
- paho-mqtt3cs paho-mqtt3as PROPERTIES
|
||||
- VERSION ${CLIENT_VERSION}
|
||||
- SOVERSION ${PAHO_VERSION_MAJOR}
|
||||
- COMPILE_DEFINITIONS "OPENSSL=1")
|
||||
- INSTALL(TARGETS paho-mqtt3cs paho-mqtt3as
|
||||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
-
|
||||
- IF (PAHO_BUILD_STATIC)
|
||||
+
|
||||
+ IF (NOT PAHO_BUILD_STATIC)
|
||||
+ ADD_LIBRARY(paho-mqtt3cs SHARED $<TARGET_OBJECTS:common_ssl_obj> MQTTClient.c SSLSocket.c)
|
||||
+ ADD_LIBRARY(paho-mqtt3as SHARED $<TARGET_OBJECTS:common_ssl_obj> MQTTAsync.c SSLSocket.c)
|
||||
+
|
||||
+ TARGET_LINK_LIBRARIES(paho-mqtt3cs ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM})
|
||||
+ TARGET_LINK_LIBRARIES(paho-mqtt3as ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM})
|
||||
+ SET_TARGET_PROPERTIES(
|
||||
+ paho-mqtt3cs paho-mqtt3as PROPERTIES
|
||||
+ VERSION ${CLIENT_VERSION}
|
||||
+ SOVERSION ${PAHO_VERSION_MAJOR}
|
||||
+ COMPILE_DEFINITIONS "OPENSSL=1")
|
||||
+ INSTALL(TARGETS paho-mqtt3cs paho-mqtt3as
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
+ ELSE()
|
||||
+ message("Build as static library")
|
||||
ADD_LIBRARY(paho-mqtt3cs-static STATIC $<TARGET_OBJECTS:common_ssl_obj> MQTTClient.c SSLSocket.c)
|
||||
ADD_LIBRARY(paho-mqtt3as-static STATIC $<TARGET_OBJECTS:common_ssl_obj> MQTTAsync.c SSLSocket.c)
|
||||
|
@ -9,6 +9,7 @@ vcpkg_from_github(
|
||||
PATCHES
|
||||
remove_compiler_options.patch
|
||||
fix-install-path.patch
|
||||
fix-static-build.patch
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PAHO_BUILD_STATIC)
|
||||
|
Loading…
Reference in New Issue
Block a user