CMake support and rtti/exceptions


I’m trying to generate a Visual Studio 2015 solution for Nsight Tegra using cmake’s build in support. The command line is:

cmake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_BUILD_TYPE=debug ../../../../

Unfortunately this generates -fno-exceptions -fno-rtti compiler flags. But my project relies on certain third party libraries wich make use of both rtti and c++ exceptions. I tried adding -DANDROID_CPP_FEATURES=“rtti exceptions” and -DCMAKE_ANDROID_CPP_FEATURES=“rtti exceptions” with no success.

My cmake verison is 3.8.0-rc4 and I’m using the latest AndroidWorks installer wich installs NDK 12b on Windows 10.

Is there any way to enable rtti and exceptions using cmake?


Hi Michael,

You can set by CMAKE cmd add_compile_options or CMAKE variable CMAKE_CXX_FLAGS/CMAKE_C_FLAGS to add the options “-fexceptions -frtti”.