首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CMake在系统根目录中找不到libcurl

问CMake在系统根目录中找不到libcurl
EN

Stack Overflow用户
提问于 2020-06-08 22:33:25
回答 1查看 317关注 0票数 0

我刚开始使用CMake。我在Debian主机上为运行嵌入式Linux的设备使用CMake进行交叉编译。下面是我的CMake工具链文件:

代码语言:javascript
复制
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找不到curl,如下所示:

代码语言:javascript
复制
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中的以下文件夹中:

代码语言:javascript
复制
/home/bsp/bsp-linux/sysroot/usr/lib/libcurl.so

为什么CMake找不到它,我怎样才能告诉CMake在这里找到这个库呢?谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-06-08 22:46:39

设置CURL_LIBRARY和CURL_INCLUDE_DIR变量或将其传递给CMake调用:

代码语言:javascript
复制
-DCURL_LIBRARY=/home/bsp/bsp-linux/sysroot/usr/lib/libcurl.so -DCURL_INCLUDE_DIR=/home/bsp/bsp-linux/sysroot/usr/include/
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62264452

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档