gpt4 book ai didi

cmake:当我导入预建库时,缺少并且没有已知的规则来制作它

转载 作者:行者123 更新时间:2023-12-03 11:54:52 33 4
gpt4 key购买 nike

我想使用这个 CmakeLists.txt 片段导入一个预构建的库:

add_library(openssl-crypto
SHARED
IMPORTED )
set_target_properties(openssl-crypto
PROPERTIES
IMPORTED_LOCATION
${external_DIR}/libs/${ANDROID_ABI}/libcrypto.so )
include_directories(${external_DIR}/include/openssl)

我将其链接到我的图书馆:
target_link_libraries(aes-crypto openssl-crypto)
尝试构建会返回此错误:
'/libs/arm64-v8a/libcrypto.so', needed by ...,  missing and no known rule to make it

最佳答案

我发现set_target_properties函数不喜欢相对路径。

来自 CMake Documentation on IMPORTED_LOCATION

Full path to the main file on disk for an IMPORTED target.



为了解决这个问题,我使用了库的完整路径。

例子:
set_target_properties ( curl-lib 
PROPERTIES IMPORTED_LOCATION
libs/${ANDROID_ABI}/libcurl.a )

. . . becomes . . .

set_target_properties ( curl-lib
PROPERTIES IMPORTED_LOCATION
${PROJECT_SOURCE_DIR}/src/main/cpp/libs/${ANDROID_ABI}/libcurl.a )

关于cmake:当我导入预建库时,缺少并且没有已知的规则来制作它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41478323/

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