I have an ndk project with a CMakeLists.txt that looks like so
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
)
it follows the pattern laid out in all of the NDK example projects listed on the googlesamples github repo. I keep getting CMake Error at CMakeLists.txt (target_link_libraries), and it seems like most people are solving it with this line
add_library(debug <files Name>)
but no one is adding that for logging. What am I doing wrong?
add below to your CMakeLists.txt above the line of target_link_libraries.
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 )
Then modify target_link_libraries as below for linking 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} )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With