How do you link third party library in Android cmake external build system?

后端 未结 2 459
野趣味
野趣味 2020-12-15 23:35

Android Studio 2.2 introduces cmake external build system. The problem is that documentation is really lacking and I do not know how should I link third party libraries? I\'

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 00:35

    For now I ended up copying libSomething.so to cmake library output directory in a post build step. This works because it turns out that Android Studio copies into apk EVERYTHING that is in that directory.

    Command in cmake is the following:

    add_custom_command(TARGET native-lib POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy
            ${CMAKE_CURRENT_SOURCE_DIR}/libs/${ANDROID_ABI}/libSomething.so
            ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libSomething.so
        )
    

提交回复
热议问题