I use cmake 3.7.2 to compile a c++ source file. I set CMAKE_ANDROID_STANDALONE_TOOLCHAIN=/my/ndk-toolchain
accronding to official guide, but the default compiler is clang and clang++. I don't know how to set complier to gcc and g++.
Asked
Active
Viewed 807 times
-1

nannanmath
- 11
- 5
-
Thanks,but why the default compiler is clang? – nannanmath Feb 20 '17 at 07:51
-
Because gcc is unsupported. – Dan Albert Feb 21 '17 at 19:57
-
If you change the name of clang in tool-chain/bin directory, cmake can find and set gcc and g++ compliers as its default compiler. – nannanmath Feb 27 '17 at 02:22
1 Answers
0
As far as I know, clang is the default compiler for NDK applications. Probably, the toolchain you are using has configured 'clang' as the compiler, but it should be the correct option.
You can check the readme file of the googlesource site.

goe
- 2,272
- 1
- 19
- 34
-
I find that in source code of cmake, if `clang` and `clang++` exist in toolchain/bin, the cxx compiler will be set as clang. That means clang is default compiler in cmake 3.7.2 for ndk toolchain. – nannanmath Feb 20 '17 at 10:43