Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No merge between the CMake flags and the default flags #219

Closed
nguillot opened this issue Oct 13, 2016 · 5 comments
Closed

No merge between the CMake flags and the default flags #219

nguillot opened this issue Oct 13, 2016 · 5 comments

Comments

@nguillot
Copy link

Studio Build: #AI-145.3276617
NDK: 13.0.3315539
Version of Gradle Plugin: 2.2.0
Version of Gradle: 2.14.1
Version of Java: 1.8.0_76
OS: Mac OS 10.12

Steps to Reproduce:

  1. Download the project https://github.com/nguillot/android-cmake
  2. checkout the c++_shared branch
  3. build the project
  4. in command line do
    cat /Users/nicolasguillot/Documents/projets/android-cmake/core/lib/android/.externalNativeBuild/cmake/debug/x86/android_gradle_build.json

Expected result:
The flags element is build according to the CMake value.

Result
the flags element contains -fno-rtti -std=c++11 --std=c++11 -frtti
I added the last two in the root CMake. By default it seems that we have the -fno-rtti flag which does not take into account the CMake flag -frtti.

@nguillot
Copy link
Author

I observed the same result when using the Gradle cppFlags flags.

@nguillot
Copy link
Author

I'm a newbies c++ dev. And I first observed this error on a compilation error. Android Studio printed the flags.

@DanAlbert
Copy link
Member

What's the problem here? The early -fno-rtti is overridden by the later -frtti. It's not possible to prevent the prior -frtti from being emitted entirely by using cflags. You need to use ANDROID_CPP_FEATURES if you need that.

Note that pretty soon we're just going to drop the default of rtti and exceptions being off for cmake. #212.

@nguillot
Copy link
Author

Like I've said before I'm not an experienced C++ dev. An it looks strange to me to have a flag and this opposite. If you remove th default it will be clearer. Furthermore, you assure me that in our case the latest flag win, you can close the issue. Thanks.

@DanAlbert
Copy link
Member

DanAlbert commented Oct 18, 2016

Yes, the last flag wins when it comes to -frtti.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants