【发布时间】:2020-04-06 11:35:17
【问题描述】:
为了通过 CMake 合并其他开源库,我检查了类似的问题,例如:
Android Studio: Adding a library outside of the project root
但这些都是关于合并 Android-Studio 库项目而不是外部库。
就我而言,我的文件夹结构如下:
- 第三方
- 类别
- MyLib
- 类别
- 源
- MyAndroidStudio 项目
- build.gradle
- settings.gradle
- ...
-
应用
- 构建
- 库
- 源代码
- build.gradle
- ...
- MyAndroidStudio 项目
在项目 CMakeLists.txt 中,然后我添加了这个
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} MyLib)
set (MyLib_DIR ../../../thirdparty/category/MyLib)
# output lib binary
add_subdirectory (${MyLib_DIR} ./MyLib)
include_directories (${OBOE_DIR}/include)
我从示例代码中了解到,并假设 CMake 源根位于 src/MyAndroidStudioProject/app,因此 MyLib 相应地使用相对路径定位。
但是,构建项目给了我
CMake Error at /path/to/src/MyAndroidStudioProject/app/src/main/cpp/CMakeLists.txt:53 (add_subdirectory):
add_subdirectory given source "../../../thirdparty/category/MyLib"
which is not an existing directory.
我应该如何解决这个问题?我应该在项目中配置其他设置吗?
【问题讨论】:
标签: android c++ android-studio build cmake