Fix WITH_STATIC_LIBRARIES using CMake on Windows

Closes #1369. Thanks to TimmvonderMehden
This commit is contained in:
Roger A. Light 2019-08-06 12:01:29 +01:00
parent 50695f8103
commit a0e7165a9c
6 changed files with 16 additions and 9 deletions

View File

@ -50,6 +50,9 @@ endif (WITH_SOCKS)
option(WITH_SRV "Include SRV lookup support?" OFF)
option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)
option(WITH_THREADING "Include client library threading support?" ON)
if (WITH_THREADING)
add_definitions("-DWITH_THREADING")

View File

@ -4,6 +4,7 @@ Broker:
Build:
- Fix missing function warnings on NetBSD.
- Fix WITH_STATIC_LIBRARIES using CMake on Windows. Closes #1369.
1.6.4 - 20190801

View File

@ -13,10 +13,15 @@ add_executable(mosquitto_pub pub_client.c pub_shared.c ${shared_src})
add_executable(mosquitto_sub sub_client.c sub_client_output.c ${shared_src})
add_executable(mosquitto_rr rr_client.c pub_shared.c sub_client_output.c ${shared_src})
if (WITH_STATIC_LIBRARIES)
target_link_libraries(mosquitto_pub libmosquitto_static)
target_link_libraries(mosquitto_sub libmosquitto_static)
target_link_libraries(mosquitto_rr libmosquitto_static)
else()
target_link_libraries(mosquitto_pub libmosquitto)
target_link_libraries(mosquitto_sub libmosquitto)
target_link_libraries(mosquitto_rr libmosquitto)
endif()
if (QNX)
target_link_libraries(mosquitto_pub socket)

View File

@ -1,5 +1,3 @@
option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)
add_subdirectory(cpp)
include_directories(${mosquitto_SOURCE_DIR} ${mosquitto_SOURCE_DIR}/lib
@ -102,7 +100,7 @@ if (WITH_STATIC_LIBRARIES)
target_link_libraries(libmosquitto_static ${LIBRARIES})
set_target_properties(libmosquitto_static PROPERTIES
OUTPUT_NAME mosquitto
OUTPUT_NAME mosquitto_static
VERSION ${VERSION}
)

View File

@ -29,7 +29,7 @@ if (WITH_STATIC_LIBRARIES)
target_link_libraries(mosquittopp_static ${LIBRARIES})
set_target_properties(mosquittopp_static PROPERTIES
OUTPUT_NAME mosquittopp
OUTPUT_NAME mosquittopp_static
VERSION ${VERSION}
)

View File

@ -17,7 +17,7 @@ Contributors:
#ifndef MOSQUITTOPP_H
#define MOSQUITTOPP_H
#ifdef _WIN32
#if defined(_WIN32) && !defined(LIBMOSQUITTO_STATIC)
# ifdef mosquittopp_EXPORTS
# define mosqpp_EXPORT __declspec(dllexport)
# else