I\'m trying to link some C files to an NDK project that I\'m working on, and set my CMakeLists.txt
file up like below.
cmake_minimum_required(VE
I think you misunderstand the cmake syntax. Below is enough for your case.
target_link_libraries(
main
${log-lib})
Below are source files, NOT library names.
communication_api
cybtldr_api
cybtldr_parse
cybtldr_command
So, you cmake statements are not correct.
If you want to make less confusing, try to make below changes.
find_library( # Sets the name of the path variable.
log-lib
log)
add_library( # Specifies the name of the library.
my-native-lib SHARED
main.c
communication_api.c
cybtldr_api.c
cybtldr_parse.c
cybtldr_command.c
)
target_link_libraries(my-native-lib
${log-lib})
But, remember to change your Java side as well, see below example:
// Used to load the 'my-native-lib' library on application startup.
static {
System.loadLibrary("my-native-lib");
}
I just enclose my JniExample project in case you need: https://github.com/russell-shizhen/JniExample