CMake build fixes

pull/2743/merge
Roger A. Light 3 years ago
parent 910b8e2c1d
commit ed8211858e

@ -6,8 +6,13 @@ target_include_directories(client-common INTERFACE
"${OPENSSL_INCLUDE_DIR}"
"${mosquitto_SOURCE_DIR}"
)
target_sources(client-common INTERFACE ${shared_src})
if(WITH_TLS)
target_link_libraries(client-common INTERFACE OpenSSL::SSL)
endif()
if(WITH_SRV)
target_compile_definitions(client-common INTERFACE "-DWITH_SRV")
endif()

@ -6,6 +6,8 @@
#include <strings.h>
#include <mosquitto.h>
#define UNUSED(A) (void)(A)
static int run = -1;
static int proto_ver;
@ -51,6 +53,9 @@ static void on_connect(struct mosquitto *mosq, void *obj, int rc)
int mid;
mosquitto_property *props = NULL;
UNUSED(mosq);
UNUSED(obj);
if(command){
if(proto_ver == 5){
if(!strncmp(command, "subscribe", strlen("subscribe"))){
@ -174,25 +179,34 @@ static void on_connect(struct mosquitto *mosq, void *obj, int rc)
static void on_connect_with_flags(struct mosquitto *mosq, void *obj, int rc, int flags)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(rc);
UNUSED(flags);
}
static void on_connect_v5(struct mosquitto *mosq, void *obj, int rc, int flags, const mosquitto_property *props)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(rc);
UNUSED(flags);
prop_test(props);
}
static void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
(void)mosq;
(void)obj;
UNUSED(mosq);
UNUSED(obj);
run = rc;
}
static void on_disconnect_v5(struct mosquitto *mosq, void *obj, int rc, const mosquitto_property *props)
{
(void)mosq;
(void)obj;
UNUSED(mosq);
UNUSED(obj);
prop_test(props);
@ -201,20 +215,34 @@ static void on_disconnect_v5(struct mosquitto *mosq, void *obj, int rc, const mo
static void on_publish(struct mosquitto *mosq, void *obj, int mid)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
}
static void on_publish_v5(struct mosquitto *mosq, void *obj, int mid, int reason_code, const mosquitto_property *props)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
UNUSED(reason_code);
prop_test(props);
}
static void on_message(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg)
{
UNUSED(mosq);
UNUSED(obj);
msg_test(msg);
}
static void on_message_v5(struct mosquitto *mosq, void *obj, const struct mosquitto_message *msg, const mosquitto_property *props)
{
UNUSED(mosq);
UNUSED(obj);
msg_test(msg);
prop_test(props);
}
@ -222,6 +250,11 @@ static void on_message_v5(struct mosquitto *mosq, void *obj, const struct mosqui
static void on_subscribe(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
{
int tot = 0;
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
for(int i=0; i<qos_count; i++){
tot += granted_qos[i];
}
@ -230,6 +263,11 @@ static void on_subscribe(struct mosquitto *mosq, void *obj, int mid, int qos_cou
static void on_subscribe_v5(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos, const mosquitto_property *props)
{
int tot = 0;
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
for(int i=0; i<qos_count; i++){
tot += granted_qos[i];
}
@ -238,10 +276,17 @@ static void on_subscribe_v5(struct mosquitto *mosq, void *obj, int mid, int qos_
static void on_unsubscribe(struct mosquitto *mosq, void *obj, int mid)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
}
static void on_unsubscribe_v5(struct mosquitto *mosq, void *obj, int mid, const mosquitto_property *props)
{
UNUSED(mosq);
UNUSED(obj);
UNUSED(mid);
prop_test(props);
}

@ -126,7 +126,7 @@ add_executable(persist-write-test
../../src/memory_public.c
../../lib/packet_mosq.c
)
target_compile_definitions(persist-write-test PRIVATE TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" WITH_PERSISTENCE WITH_BROKER)
target_compile_definitions(persist-write-test PRIVATE TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" WITH_PERSISTENCE WITH_BROKER WITH_SYS_TREE)
target_link_libraries(persist-write-test PRIVATE persistence-write-obj OpenSSL::SSL)
add_test(NAME unit-persist-write-test COMMAND persist-write-test)
@ -150,6 +150,6 @@ add_executable(subs-test
../../src/memory_public.c
)
target_compile_definitions(subs-test PRIVATE WITH_PERSISTENCE WITH_BROKER)
target_compile_definitions(subs-test PRIVATE WITH_PERSISTENCE WITH_BROKER WITH_SYS_TREE)
target_link_libraries(subs-test PRIVATE common-unit-test-header persistence-obj)
add_test(NAME unit-subs-test COMMAND subs-test)

Loading…
Cancel
Save