我刚开始使用CMake。我在Debian主机上为运行嵌入式Linux的设备使用CMake进行交叉编译。下面是我的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找不到curl,如下所示:
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在这里找到这个库呢?谢谢。
发布于 2020-06-08 22:46:39
设置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/https://stackoverflow.com/questions/62264452
复制相似问题