Using both Paho-C and Paho-CPP
KlaasVortex opened this issue · 1 comments
When building the library without SSL and STATIC options for C and CPP the C-library naming is wrong for CPP-lib. (As far as I can tell)
As far as I can tell all static libs are have -static attached to the name. Except on non-WIN32 systems, than this is addition is removed.
I am not sure why or if this is needed. But it does create some errors.
I also tracked what is going wrong at what place. Again if I understand the purpose correctly
I do build the C and CPP as seperate cmake_modules. So not using the [PAHO_WITH_MQTT_C] option
Using Libs C 1.3.13 CPP 1.4.0.1
build SSL = false, SHARED = false, STATIC = true
Building on Ubuntu 22 LTS
From C- source/CMakeList.txt Line 159 and Line 264
IF (NOT WIN32)
SET_TARGET_PROPERTIES(paho-mqtt3cs-static PROPERTIES OUTPUT_NAME paho-mqtt3cs)
SET_TARGET_PROPERTIES(paho-mqtt3as-static PROPERTIES OUTPUT_NAME paho-mqtt3as)
ENDIF()
This will create the lib with name -- libpaho-mqtt3cs.a
From CPP/CMakeList.txt Line 77
if(PAHO_BUILD_STATIC AND NOT PAHO_BUILD_SHARED)
set(PAHO_MQTT_C_LIB ${PAHO_MQTT_C_LIB}-static)
endif()
This will create the name -- libpaho-mqtt3cs-static
So the CPP is looking for a lib that is NOT there.
A solution would be adding WIN32 as condition
if(PAHO_BUILD_STATIC AND WIN32 AND NOT PAHO_BUILD_SHARED)
Or keep the static addition to the name
IF (0)
SET_TARGET_PROPERTIES(paho-mqtt3cs-static PROPERTIES OUTPUT_NAME paho-mqtt3cs)
SET_TARGET_PROPERTIES(paho-mqtt3as-static PROPERTIES OUTPUT_NAME paho-mqtt3as)
ENDIF()
@fpagliughi FYI