Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build eclipse paho with cmake

Tags:

cmake

paho

im very new to cmake. I want to add eclipse paho to my project, therefor I use "ExternalProject_add". Here is an extract of my CMakeLists.txt:

ExternalProject_add( 
libressl
URL ${CMAKE_SOURCE_DIR}/externals/libressl-2.5.0.tar.gz
CONFIGURE_COMMAND ./configure --disable-hardening --prefix=${CMAKE_BINARY_DIR}
BUILD_IN_SOURCE 1)

ExternalProject_add( 
paho
DEPENDS libressl
URL ${CMAKE_SOURCE_DIR}/externals/eclipse-paho-mqtt-c-src-1.1.0.tar.gz
CMAKE_ARGS -DPAHO_WITH_SSL -DOPENSSL_INC_SEARCH_PATH=${CMAKE_SOURCE_DIR}/include -DOPENSSL_LIB_SEARCH_PATH=${CMAKE_SOURCE_DIR}/lib
BUILD_COMMAND make
BUILD_IN_SOURCE 1)

The thing is libressl is building just fine. As you can see it uses autoconf-tools.

My Problem is that paho throws an error at the "configure step".

 ~/projects/cmake_test/CL_Test/build$ cmake ..
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /projects/cmake_test/CL_Test/build
 :~/projects/cmake_test/CL_Test/build$ make
 [ 50%] Built target libressl
 [ 56%] Performing configure step for 'paho'
 CMake Error at /projects/cmake_test/CL_Test/build/paho-prefix/src/paho-stamp/paho-configure-.cmake:16 (message):
 Command failed: 1

 '/usr/bin/cmake' '-DPAHO_WITH_SSL' '-DOPENSSL_INC_SEARCH_PATH=/home/hbaumann/projects/cmake_test/CL_Test/include' '-DOPENSSL_LIB_SEARCH_PATH=/home/hbaumann/projects/cmake_test/CL_Test/lib' '-GUnix Makefiles' '/projects/cmake_test/CL_Test/build/paho-prefix/src/paho'

 CMakeFiles/paho.dir/build.make:107: recipe for target 'paho-prefix/src/paho-stamp/paho-configure' failed
 make[2]: *** [paho-prefix/src/paho-stamp/paho-configure] Error 1
 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/paho.dir/all' failed
 make[1]: *** [CMakeFiles/paho.dir/all] Error 2
 Makefile:83: recipe for target 'all' failed
 make: *** [all] Error 2

I thought, since paho is build with the use of CMake by default, there is nothing I really need to add. Here you can see, my knowledge about CMake is really low.

What makes me wonder is that in the paho tar-ball, there is only a Makefile in the main folder and not an CMakeLists.txt.

What do i miss... is there a special configure command I need to set ?

thx in advance

like image 845
Heiko Avatar asked Dec 05 '25 16:12

Heiko


1 Answers

you can use the GIT repository, it has a CMakeList.txt.

ExternalProject_add(
paho
DEPENDS libressl
GIT_REPOSITORY "https://github.com/eclipse/paho.mqtt.c.git"
GIT_TAG "master"
UPDATE_COMMAND ""
PATCH_COMMAND ""
SOURCE_DIR "${CMAKE_BINARY_DIR}/paho_sourcedir"
CMAKE_ARGS -DPAHO_WITH_SSL=TRUE -DOPENSSL_INC_SEARCH_PATH=${CMAKE_BINARY_DIR}/include -DOPENSSL_LIB_SEARCH_PATH=${CMAKE_BINARY_DIR}/lib -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/paho_prefix
)
like image 189
Kalle Blomkvist Avatar answered Dec 08 '25 20:12

Kalle Blomkvist