eclipse-paho / paho.mqtt.cpp

Other
1.03k stars 438 forks source link

CMake error while compiling paho.mqtt.cpp #493

Closed divyeshsie closed 4 months ago

divyeshsie commented 5 months ago

Hello,

I'm starting with MQTT and cloned the repository as per the steps mentioned in README. I am facing following errors while compiling the project, can anyone please help me to resolve this issue.

Steps followed:

CMake command: cmake -Bbuild -H. -DPAHO_WITH_MQTT_C=ON -DPAHO_BUILD_STATIC=ON -DPAHO_BUILD_DOCUMENTATION=ON -

CMake output: DPAHO_BUILD_SAMPLES=ON -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Paho C: Bundled CMake Error at CMakeLists.txt:60 (add_subdirectory): add_subdirectory given source "/home/divyesh/src/ipc/mqtt/src/paho.mqtt.cpp/externals/paho-mqtt-c" which is not an existing directory.

CMake Error at CMakeLists.txt:64 (add_library): add_library cannot create ALIAS target "eclipse-paho-mqtt-c::paho-mqtt3a" because target "paho-mqtt3a" does not already exist.

CMake Error at CMakeLists.txt:66 (add_library): add_library cannot create ALIAS target "eclipse-paho-mqtt-c::paho-mqtt3as" because target "paho-mqtt3as" does not already exist.

lefi7z commented 4 months ago

I just encountered the same issue. Turns out, the submodule path is (incorrectly?) set to src\externals\paho-mqtt-c.

As a workaround, run

to move the submodule.

divyeshsie commented 4 months ago

It works, thank you.

fpagliughi commented 4 months ago

Thanks. The fix is up in master.

fpagliughi commented 4 months ago

I believe this is fixed. If not, please re-open.