Conversation
When compiling with android studio, android studio call set CMAKE_TOOLCHAIN_FILE to ${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake
This file import android-legacy.toolchain.cmake and I realised that depending on the build type, it is setting different variant of CFLAGS, CXXFLAGS and LDFLAGS.
This is their values (CMAKE_CXX_FLAGS_XXX is the same as CMAKE_C_FLAGS_XXX):
```
CMAKE_C_FLAGS_RELEASE: -O3 -DNDEBUG
CMAKE_C_FLAGS_DEBUG: -fno-limit-debug-info
CMAKE_C_FLAGS_RELWITHDEBINFO: -O2 -g -DNDEBUG
CMAKE_SHARED_LINKER_FLAGS_RELEASE: -Wl,--gc-sections
CMAKE_SHARED_LINKER_FLAGS_DEBUG is empty
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO: -Wl,--gc-sections
```
Unfortunatly, CMAKE_C_FLAGS always contains the "-g" flags, so even release build have symbol:
```
-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
```
PS: CMAKE_CXX_FLAGS is equal to CMAKE_C_FLAGS.
Contributor
Author
|
By default, it seems that if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When compiling with android studio, android studio call set CMAKE_TOOLCHAIN_FILE to ${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake
This file import android-legacy.toolchain.cmake and I realised that depending on the build type, it is setting different variant of CFLAGS, CXXFLAGS and LDFLAGS.
This is their values (CMAKE_CXX_FLAGS_XXX is the same as CMAKE_C_FLAGS_XXX):
Unfortunatly, CMAKE_C_FLAGS always contains the "-g" flags, so even release build have symbol:
PS: CMAKE_CXX_FLAGS is equal to CMAKE_C_FLAGS.