I have an Android NDK project which builds libMyProject1.so and I am using:
set_target_properties(MyProject1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../Client/libs/${ANDROID_ABI}") to export the built library to the folder that I need.
I also have another external shared library that I link with:
MyExternal library
add_library(MyExternal SHARED IMPORTED) set_target_properties(MyExternal PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../MyExternal/libs/${ANDROID_ABI}/libMyExternal.so) target_link_libraries( # Specifies the target library. MyProject1 # Shared Dependencies MyExternal # Links the target library to the log library # included in the NDK. ${log-lib}) libMyProject1.so is copied to Client/libs/${ANDROID_ABI} but libMyExternal.so is not copied. How to copy the external shared library to my client folder using cmake?
LIBRARY_OUTPUT_DIRECTORYaffects only on the library produced by your project. It doesn't affect on IMPORTED libraries which have already exist. You need to copy such library manually. Choose any way described in that question: stackoverflow.com/questions/34799916/….