CMakeLists.txt revision 06956f3dd31a7e71bac119982a9a7db31259050e
1# For more information about using CMake with Android Studio, read the 2# documentation: https://d.android.com/studio/projects/add-native-code.html 3 4# Sets the minimum version of CMake required to build the native library. 5 6cmake_minimum_required(VERSION 3.4.1) 7 8# Creates and names a library, sets it as either STATIC 9# or SHARED, and provides the relative paths to its source code. 10# You can define multiple libraries, and CMake builds them for you. 11# Gradle automatically packages shared libraries with your APK. 12 13add_library( # Sets the name of the library. 14 native-lib 15 16 # Sets the library as a shared library. 17 SHARED 18 19 # Provides a relative path to your source file(s). 20 src/main/cpp/native-lib.cpp ) 21 22# Searches for a specified prebuilt library and stores the path as a 23# variable. Because CMake includes system libraries in the search path by 24# default, you only need to specify the name of the public NDK library 25# you want to add. CMake verifies that the library exists before 26# completing its build. 27 28find_library( # Sets the name of the path variable. 29 log-lib 30 31 # Specifies the name of the NDK library that 32 # you want CMake to locate. 33 log ) 34 35# Specifies libraries CMake should link to your target library. You 36# can link multiple libraries, such as libraries you define in this 37# build script, prebuilt third-party libraries, or system libraries. 38 39target_link_libraries( # Specifies the target library. 40 native-lib 41 42 # Links the target library to the log library 43 # included in the NDK. 44 ${log-lib} )