#117 Added the ability to generate Windows shared library (DLL) and fixed static lib generation on Windows

This commit is contained in:
fmp 2018-12-08 18:39:01 -05:00
parent 513de62951
commit 7c473f6962
4 changed files with 8 additions and 12 deletions

View File

@ -60,6 +60,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
include(GNUInstallDirs)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(LIBS_SYSTEM ws2_32)
elseif(UNIX)
set(LIBS_SYSTEM c stdc++)

View File

@ -37,9 +37,9 @@ for COMPILER in $COMPILERS; do
exit 1
fi
printf "Running unit tests:\n"
printf "Running unit tests for %s:\n" "${COMPILER}"
if ! ./test/unit/paho-mqttpp-test ; then
printf "\nUnit test failed for %s\n" "${COMPILER}"
printf "\nUnit test failed for %s\n" "${COMPILER}"
exit 3
fi

View File

@ -30,9 +30,6 @@ constexpr bool message::DFLT_RETAINED;
const MQTTAsync_message message::DFLT_C_STRUCT = MQTTAsync_message_initializer;
const string message::EMPTY_STR;
const binary message::EMPTY_BIN;
// --------------------------------------------------------------------------
message::message() : msg_(DFLT_C_STRUCT)

View File

@ -61,11 +61,6 @@ private:
/** Initializer for the C struct (from the C library) */
static const MQTTAsync_message DFLT_C_STRUCT;
/** An instance of an empty string (for performance) */
static const string EMPTY_STR;
/** An instance of an empty binary (for performance) */
static const binary EMPTY_BIN;
/** The underlying C message struct */
MQTTAsync_message msg_;
/** The topic that the message was (or should be) sent on. */
@ -236,6 +231,7 @@ public:
* @return The topic string for the message.
*/
const string& get_topic() const {
static const string EMPTY_STR;
return topic_ ? topic_.str() : EMPTY_STR;
}
/**
@ -249,13 +245,15 @@ public:
/**
* Gets the payload
*/
const binary& get_payload() const {
const binary& get_payload() const {
static const binary EMPTY_BIN;
return payload_ ? payload_.str() : EMPTY_BIN;
}
/**
* Gets the payload as a string
*/
const string& get_payload_str() const {
const string& get_payload_str() const {
static const string EMPTY_STR;
return payload_ ? payload_.str() : EMPTY_STR;
}
/**