Я пытаюсь преобразовать свои проекты cpp для Android NDK (ndk-build with Android.mk) в CMAKE в Android Studio.У меня есть проектная иерархия, подобная этой:
.
├── Module1
│ ├── CMakeLists.txt
│ ├── include
│ │ └── Module1
│ ├── libModule1
│ │ ├── Module1File1.cpp
│ │ └── Module1File2.cpp
│ └── utModule1
├── MyProject
│ ├── CMakeLists.txt
│ ├── MyProject.iml
│ ├── build
│ │ ├── generated
│ │ ├── intermediates
│ │ └── outputs
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │
│ ├── MyProjectFile1.cpp
│ └── MyProjectFile2.cpp
|
└── settings.gradle
Module1 CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
add_library( # Specifies the name of the library.
Module1
# Sets the library as a shared library.
STATIC
# Provides a relative path to your source file(s).
libModule1/Module1File1.cpp
libModule1/Module1File2.cpp )
MyProject CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
add_subdirectory(../MyModule1)
add_library( # Specifies the name of the library.
MyProject
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/MyProjectFile1.cpp
src/MyProjectFile2.cpp)
target_link_libraries( # Specifies the target library.
MyProject
# Dependencies
MyModule1
# Links the target library to the log library
# included in the NDK.
${log-lib})
Я вижу следующую ошибку при сборке:
CMake Error at CMakeLists.txt (add_subdirectory):
Как включить MyModule1 в MyProject?