Android Studio cmake suddenly without syntax highlighting

NDK development, build.gradletemporarily add a -fnoexceptioncompiler option:

        externalNativeBuild {
            cmake {
                cppFlags '-std=c++11 -fexceptions'   //!!!这里是新增的
                arguments '-DANDROID_PLATFORM=android-21',
                    '-DCMAKE_BUILD_TYPE="Release',
                    '-DANDROID_ARM_NEON=ON',
                    '-DANDROID_STL=c++_shared'
//                cppFlags '-std=c++11'
//                arguments '-DANDROID_TOOLCHAIN=clang',
//                        '-DANDROID_STL=c++_static'
//                cppFlags "-std=c++11 -fexceptions"
            }
        }

The results, click on the sync nowfollowing, CMake scripts have lost highlighting and error prompt clang ++ can not identify -fnoexception. Inspection found CMake script is set in the CMAKE_CXX_FLAGSvalue of which has -fno-exceptionscaused can be removed:

#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions -fno-short-enums -Werror=non-virtual-dtor")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-short-enums -Werror=non-virtual-dtor")

That is build.gradle cmake scripts and script of the C ++ compiler options, whether to enable exception for the conflict caused.

Guess you like

Origin www.cnblogs.com/zjutzz/p/12159112.html