码迷,mamicode.com
首页 > 其他好文 > 详细

NDK开发使用cMake方式 - 添加其他的预编译库

时间:2017-09-29 15:05:44      阅读:278      评论:0      收藏:0      [点我收藏+]

标签:lists   div   博文   class   port   开发   net   share   txt   

NDK 开发使用cMake方式,网上能找到不少的教程,这里推荐一篇博文:

http://blog.csdn.net/wl9739/article/details/52607010

关于添加其他的预编译库,网上很多文章写得不太准确,这里说下步骤:

1,将预编译库加入项目

技术分享

2,编辑CMakeLists.txt,动态链接库是SHARED,静态是STATIC。

关键是IMPORTED_LOCATION。CMAKE_SOURCE_DIR不用手动定义,指向CMakeLists.txt所在的目录。

add_library(smartcomm-lib SHARED IMPORTED)
set_target_properties(
                      smartcomm-lib
                      PROPERTIES
                      IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libsmartcomm.so
)

target_link_libraries( # Specifies the target library.
target-lib

smartcomm-lib)

 

NDK开发使用cMake方式 - 添加其他的预编译库

标签:lists   div   博文   class   port   开发   net   share   txt   

原文地址:http://www.cnblogs.com/z-bin/p/7609819.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!