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

avoid adding Paho MQTT C library twice #350

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

koalo
Copy link
Contributor

@koalo koalo commented Jul 19, 2021

If a library is included that itself uses the Paho MQTT C++ it is not possible to add Paho MQTT C++ a second time. This results in the following message

| add_library cannot create imported target "PahoMqttC::PahoMqttC" because
| another target with the same name already exists.

It is not always possible to avoid such scenario (e.g. if third party software is used), so it is better to prevent this error.

@koalo koalo changed the base branch from master to develop July 19, 2021 08:00
Signed-off-by: Florian Kauer <koalo@koalo.de>
@HpLightcorner
Copy link
Contributor

Have been running into the same issue - especially when building paho.mqtt.c and paho.mqtt.cpp in the same CMake top project (e.g. in a continuous integration environment, no package managers allowed etc. etc.). Also, using the current CMake build with FetchContent is more or less impossible (as CMake has its own issues with find_library and FetchContent...) I wonder if a PR would be accepted, which ads paho.mqtt.c as a GIT submodule, an additional CMake flag (e.g. PAHO_CPP_USE_INTERNAL_MQTT_C) indicates to use the submodule or find_library? Not sure if this works out of the box - but this would allow for the FetchContent dependency management workflow. What is your opinion on that, @fpagliughi ?

@strahlc
Copy link
Contributor

strahlc commented Jul 22, 2022

+1
Please merge!

@fpagliughi
Copy link
Contributor

Sorry for the unbelievably slow response!

@fpagliughi fpagliughi merged commit 62868ec into eclipse-paho:develop Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants