CMake: Add wxUSE_NO_RTTI option

This is similar to configure --enable-no_rtti option.

Closes https://github.com/wxWidgets/wxWidgets/pull/1405
This commit is contained in:
Deamhan 2019-07-13 00:38:30 +03:00 committed by Vadim Zeitlin
parent 67361b89d5
commit b92c30191c
2 changed files with 11 additions and 0 deletions

View File

@ -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}-")

View File

@ -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")