gpt4 book ai didi

cmake - 如何使用 cmake 构建 eclipse paho

转载 作者:行者123 更新时间:2023-12-01 07:36:38 25 4
gpt4 key购买 nike

我是 cmake 的新手。我想将 eclipse paho 添加到我的项目中,因此我使用“ExternalProject_add”。这是我的 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)

重要的是 libressl 构建得很好。如您所见,它使用 autoconf-tools。

我的问题是 paho 在“配置步骤”抛出错误。

 ~/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

我想,因为 paho 是默认使用 CMake 构建的,所以我真的不需要添加任何东西。在这里你可以看到,我对CMake的了解真的很低。

让我奇怪的是,在 paho tar-ball 中,主文件夹中只有一个 Makefile 而不是 CMakeLists.txt。

我想念什么...我需要设置一个特殊的配置命令吗?

提前谢谢

最佳答案

您可以使用 GIT 存储库,它有一个 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
)

关于cmake - 如何使用 cmake 构建 eclipse paho,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40175217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com