cpm-cmake / CPM.cmake

📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
MIT License
2.87k stars 182 forks source link

sub dependency issue #262

Open dpower5 opened 3 years ago

dpower5 commented 3 years ago

Trying to build paho-mqtt-cpp which requires paho-mqtt-c to be installed. Both projects are CMake based. Able to get it to work with building cpp using cpm.make version, when the c version is installed manually.

But I would like to install both using cpm.cmake. here is my first try. but the compilation of the cpp version fails with error as its not able to find the C version libraries in the library path. Is it possible to install both versions thru cpm.cmake by linking the paho-mqtt-c_LIBRARIES to paho-mqtt-cpp

CPMAddPackage(
            NAME paho-mqtt-c
            GIT_REPOSITORY https://github.com/eclipse/paho.mqtt.c.git
            VERSION 1.3.8
            OPTIONS "PAHO_ENABLE_TESTING OFF" "PAHO_WITH_SSL ON" "PAHO_HIGH_PERFORMANCE ON"
    )
#    libpaho-mqtt-3a and libpaho-mqtt-3c are built by the c version and needed for the compilation of paho-mqtt-cpp

    CPMAddPackage(
            NAME paho-mqtt-cpp
            GIT_REPOSITORY https://github.com/eclipse/paho.mqtt.cpp.git
            VERSION 1.2.0
            OPTIONS "PAHO_BUILD_STATIC ON"
    )
dpower5 commented 3 years ago

@TheLartians, that you for your efforts. I would like to know if something like the above(installing sub dependencies) is possible.

TheLartians commented 3 years ago

Hey, theoretically it is possible, as CPM creates FindXXX.cmake module files to allow dependencies to use find_package. However we are strongly dependent on library developers to create CMake scripts that work as independent modules - e.g. they should create and export their targets consistently in the CMake lists and module files.

I've done a small test run with your script above and was still running into installation issues after some trying. Maybe you could also open an issue asking for assistance at the paho-mqtt repositories.

msis commented 2 years ago

@dpower5 did you find a solution to this?

dpower5 commented 2 years ago

No. I ended up using conan.

On Mon, Jul 25, 2022 at 2:46 PM Mohamed Saad Ibn Seddik < @.***> wrote:

@dpower5 https://github.com/dpower5 did you find a solution to this?

— Reply to this email directly, view it on GitHub https://github.com/cpm-cmake/CPM.cmake/issues/262#issuecomment-1194671254, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVRV3DLXOI74Z37ITS7ZHDVV4DJXANCNFSM46CPJSGA . You are receiving this because you were mentioned.Message ID: @.***>