Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using both Paho-C and Paho-CPP #1434

Open
KlaasVortex opened this issue Dec 19, 2023 · 1 comment
Open

Using both Paho-C and Paho-CPP #1434

KlaasVortex opened this issue Dec 19, 2023 · 1 comment
Labels

Comments

@KlaasVortex
Copy link

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()

@icraggs icraggs added the build label Feb 9, 2024
@icraggs
Copy link
Contributor

icraggs commented Feb 9, 2024

@fpagliughi FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants