gpt4 book ai didi

android - 添加日志时 CMakeLists.txt (target_link_libraries) 中的 CMake 错误

转载 作者:搜寻专家 更新时间:2023-11-01 09:23:08 25 4
gpt4 key购买 nike

我有一个带有 CMakeLists.txt 的 ndk 项目,看起来像这样

cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")

add_library( # Specifies the name of the library.
main

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
main.c)

target_link_libraries(
android
log
)

它遵循 googlesamples github 存储库中列出的所有 NDK 示例项目中列出的模式。我不断收到 CMakeLists.txt (target_link_libraries) 中的 CMake Error,似乎大多数人都在用这一行解决它

add_library(debug <files Name>)

但是没有人将其添加到日志记录中。我做错了什么?

最佳答案

target_link_libraries 行上方的 CMakeLists.txt 中添加以下内容。

find_library( # Sets the name of the path variable.
log-lib

# Specifies the name of the NDK library that
# you want CMake to locate.
log )

然后修改target_link_libraries 如下链接android log lib

target_link_libraries( # Specifies the target library.
main

# Links the target library to the log library
# included in the NDK.
${log-lib} )

关于android - 添加日志时 CMakeLists.txt (target_link_libraries) 中的 CMake 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52940459/

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