我是不熟悉CMake的人。我正在Debian主机上使用CMake交叉编译运行嵌入式Linux的设备。以下是我的CMake工具链文件:
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
# this is the location of the amd64 toolchain targeting the device
SET(CMAKE_C_COMPILER /home/bsp/bsp-linux/bin/arm-linux-gnueabi-gcc)
# this is the file system root of the target
SET(CMAKE_FIND_ROOT_PATH /home/bsp/bsp-linux/sysroot)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(OPENSSL_ROOT_DIR /home/bsp/bsp-linux/sysroot/usr/lib)
SET(OPENSSL_INCLUDE_DIR /home/bsp/bsp-linux/sysroot/usr/include/openssl)
我遇到如下错误,CMake无法找到卷曲,如下所示:
Cross compiling not using pkg-config
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find CURL (missing: CURL_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
c-utility/CMakeLists.txt:522 (find_package_handle_standard_args)
libcurl位于以下文件夹中目标的sysroot中:
/home/bsp/bsp-linux/sysroot/usr/lib/libcurl.so
为什么CMake找不到这个,我怎么告诉CMake在这里找到库?谢谢。
SET或将CURL_LIBRARY和CURL_INCLUDE_DIR变量传递给您的CMake调用:
-DCURL_LIBRARY=/home/bsp/bsp-linux/sysroot/usr/lib/libcurl.so -DCURL_INCLUDE_DIR=/home/bsp/bsp-linux/sysroot/usr/include/