EXPORT form is useful to help outside projects use targets built and installed by the current project. For example, the code
install(TARGETS myexe EXPORT myproj DESTINATION bin)
install(EXPORT myproj NAMESPACE mp_ DESTINATION lib/myproj)
install(EXPORT_ANDROID_MK myproj DESTINATION share/ndk-modules)
will install the executable
<prefix>/bin and code to import it in the file
<prefix>/share/ndk-modules/Android.mk . An outside project may load this file with the include command and reference the
myexe executable from the installation tree using the imported target name
mp_myexe as if the target were built in its own tree.
I’m not quite sure about this solution. Why do we need
<prefix>/lib/myprij/myproj.cmake at all? Can we use
<prefix>/share/ndk-modules/Android.mk as standalone Makefile, I mean without
If the answer is yes, then
install(EXPORT_ANDROID_BP) is the solution we are looking for.
I have only one concern here.
Android.bp doesn’t have “if” statements at all. All control flow logic is implemented in GO-lang modules which come in parrallel to Android.bp. How this can be handled?
If the answer is no, then this solution is not proper for us, as building with NDK and cmake toolchain under Android seems to take more time, than “native” Android.bp solution, especially when we are compiling both x86 and x86_64 shared libraries.