Reputation: 569
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?
Upvotes: 6
Views: 4335
Reputation: 76
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.
Upvotes: 4