I would like to integrate the "Armadillo" library into my Kotlin and C++ native module project; however, I am encountering difficulties with the linking process. The CMakeLists.txt file is structured as follows:
cmake_minimum_required(VERSION 3.22.1)
project("nativelib")
include_directories(${PROJECT_SOURCE_DIR}/armadillo/include)
add_library(armadillo SHARED IMPORTED)
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
nativelib.cpp)
target_link_libraries(${CMAKE_PROJECT_NAME}
# List libraries link to the target library
android
log
armadillo
)
And the error is like the below:
Task :nativelib:configureCMakeDebug[arm64-v8a] FAILED
C/C++: CMake Error in CMakeLists.txt:
C/C++: IMPORTED_LOCATION not set for imported target "armadillo" configuration
C/C++: "Debug".
C/C++: CMake Error in CMakeLists.txt:
C/C++: IMPORTED_LOCATION not set for imported target "armadillo" configuration
C/C++: "Debug".
C/C++: CMake Generate step failed. Build files cannot be regenerated correctly.
The error is not limited to arm64-v8a; it also extends to armeabi-v7a, x86, and x86_64 architectures.
CMake Error in CMakeLists.txt:
IMPORTED_LOCATION not set for imported target "armadillo" configuration
"Debug".
CMake Error in CMakeLists.txt:
IMPORTED_LOCATION not set for imported target "armadillo" configuration
"Debug".
I am a beginner in Android NDK development, and I require the Armadillo library for my project. Despite attempting to use the set_target_properties function, I have not been successful in its implementation.