From b92c30191cf32d155b00eb489df918cef50a6a33 Mon Sep 17 00:00:00 2001 From: Deamhan Date: Sat, 13 Jul 2019 00:38:30 +0300 Subject: [PATCH] CMake: Add wxUSE_NO_RTTI option This is similar to configure --enable-no_rtti option. Closes https://github.com/wxWidgets/wxWidgets/pull/1405 --- build/cmake/init.cmake | 9 +++++++++ build/cmake/options.cmake | 2 ++ 2 files changed, 11 insertions(+) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 9770624b99..080c384795 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -50,6 +50,15 @@ if(wxBUILD_COMPATIBILITY VERSION_LESS 3.1) set(WXWIN_COMPATIBILITY_3_0 ON) endif() +if(wxUSE_NO_RTTI) + if(MSVC) + add_compile_options("/GR-") + elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + add_compile_options("-fno-rtti") + endif() + add_definitions("-DwxNO_RTTI") +endif() + # Build wxBUILD_FILE_ID used for config and setup path #TODO: build different id for WIN32 set(wxBUILD_FILE_ID "${wxBUILD_TOOLKIT}${wxBUILD_WIDGETSET}-") diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index b7703811ac..ecd96a003c 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -44,6 +44,8 @@ if(WIN32) set(wxBUILD_VENDOR "custom" CACHE STRING "Short string identifying your company (used in DLL name)") endif() +wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF) + # STL options wx_option(wxUSE_STL "use standard C++ classes for everything" OFF) set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes")