Skip to content

CMake Error at src/CMakeLists.txt:100 (target_link_libraries) #546

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

Open
sbf- opened this issue Mar 19, 2025 · 2 comments
Open

CMake Error at src/CMakeLists.txt:100 (target_link_libraries) #546

sbf- opened this issue Mar 19, 2025 · 2 comments
Milestone

Comments

@sbf-
Copy link

sbf- commented Mar 19, 2025

While trying to build the library on windows 10 (following the readme) I get this output with error at the end:
Source is the current master branch

cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=C:\mqtt\paho-cpp -DPAHO_BUILD_SAMPLES=ON -DPAHO_WITH_SSL=OFF -DCMAKE_PREFIX_PATH=C:\mqtt\paho-c

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.43.34808.0
-- The CXX compiler identification is MSVC 19.43.34808.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - 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: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success

CMake Error at src/CMakeLists.txt:100 (target_link_libraries):
  Target "paho-mqttpp3-static" links to:

    eclipse-paho-mqtt-c::paho-mqtt3a-static

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

-- Generating done (0.3s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
@fpagliughi
Copy link
Contributor

The build is not finding the Paho C library, which it requires.

You now have two choices for this. You can build and install the C library first. Or, now, you can build them together with the CMake available here in this library. If you just need the C++ library, this second way is much easier.

I probably need to clarify this better in the Windows section of the README. The section higher up in the instructions should work for Windows:
https://github.com/eclipse-paho/paho.mqtt.cpp?tab=readme-ov-file#build-the-paho-c-and-paho-c-libraries-together

@fpagliughi
Copy link
Contributor

This may require the latest Paho C to be installed. v1.3.14

Have you had any success resolving this?

@fpagliughi fpagliughi added this to the v1.5.4 milestone May 16, 2025
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

No branches or pull requests

2 participants