I need to reference the android build type (debug, release) into a CMakeLists.txt file I use for building an external native library. More exactly:
set_target_properties( # Specifies the target library.
mylibname
# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION
# Provides the path to the library you want to import.
$ENV{LIBRARY_HOME}/${ANDROID_BUILD_TYPE}/libs/${ANDROID_ABI}/libMylib.a
I need the equivalent of ${ANDROID_ABI}, which changes the build per abi type, in place of ${ANDROID_BUILD_TYPE} which is, of course, a name of example. That is: which is the name of that variable? And, more generally, is there a list of them all somewhere?
The CMakeLists. txt file is at the top directory of the ROOT git repository. If you don't have that file, then there is a problem with your git checkout. Please make sure that the path you provide to CMake is the path to the top directory of the repository, and that the file is there.
It will now default to using a debug build if the source directory is a git clone, or a release build if not. It is also quite easy to customize its behavior according to the preferences of your project.
Specifies the build type on single-configuration generators (e.g. Makefile Generators or Ninja ). Typical values include Debug , Release , RelWithDebInfo and MinSizeRel , but custom build types can also be defined.
I found that you can use ${CMAKE_BUILD_TYPE}
for this, which evaluates to Release
or Debug
. I'm not sure if this is the same thing as the actual Android build configurations or a separate configuration for CMake, but at least for the simple case of debug/release configurations it works. On case-sensitive platforms you might have to convert the result to lowercase.
The build arguments listed at https://developer.android.com/ndk/guides/cmake are probably named directly after the variables they set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With