Skip to content

Instantly share code, notes, and snippets.

@patm1987
Last active May 3, 2021 08:15
Show Gist options
  • Save patm1987/1128fb1499d3fe0c23bb50a33c0e4d9f to your computer and use it in GitHub Desktop.
Save patm1987/1128fb1499d3fe0c23bb50a33c0e4d9f to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.6.0)
add_library(native_app_glue STATIC
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
target_include_directories(native_app_glue PUBLIC
${ANDROID_NDK}/sources/android/native_app_glue)
find_library(log-lib
log)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
add_library(helloworld-c SHARED
src/main/cpp/helloworld-c.cpp)
target_link_libraries(helloworld-c
android
native_app_glue
${log-lib})
@aoriani
Copy link

aoriani commented Mar 5, 2019

There's a typo on target_link_libraries. It should be native_app_glue instead of native_app_blue

@patm1987
Copy link
Author

patm1987 commented Mar 5, 2019

Thanks! I originally used screencaptures for all my code snippets, and changed them to code at the last second for submission to the Android blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment