我很新于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 工具。
我的问题是,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。
我错过了什么...是否需要设置特殊的configure命令?
提前感谢。