[FR] [QUESTION] How to model optional dependencies?
- Dominant language
- Kotlin
- Stars
- 236
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
My application is able to dynamically load dependencies using `dlopen` + `dladdr`.
I have modeled every library using prefab json files.
But I don't know of any way, other then explicitly do `target_link_libraries` to add a dynamic dependency to the `.apk`.
**Describe the solution you'd like**
I have 2 suggestions:
1. add every dependency of the target to the `.apk`.
Doing `add_dependencies(myexecutable dynamic_dependency)`, should add `dynamic_dependency` to the `.apk` as well
2. add some function to the android cmake toolchain script that marks a target to be added to the `.apk`:
`add_target_to_apk(dynamic_dependency)`
**Describe alternatives you've considered**
Right now, I'm simply doing
```
target_link_libraries(mygame PRIVATE dynamic_dependency)
```
This type of dependency is honored by android's cmake support,
but should not be necessary.
**Additional context**
I have encountered this issue while creating a prefab aar for SDL_image.
SDL_image provides decoders for various image formats.
Because not every applications needs every decoder, these are dynamically loaded.
Dynamically loading also reduces the file size of an `.apk`.
Contributor guide
Assessment
This issue has not been assessed yet.