diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index c00c968bdb..f21a402b22 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -152,6 +152,15 @@ function(wx_set_common_target_properties target_name) ) endif() + if(wxUSE_NO_RTTI) + if(MSVC) + target_compile_options(${target_name} PRIVATE "/GR-") + elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) + target_compile_options(${target_name} PRIVATE "-fno-rtti") + endif() + target_compile_definitions(${target_name} PRIVATE "-DwxNO_RTTI") + endif() + if(wxBUILD_LARGEFILE_SUPPORT) target_compile_definitions(${target_name} PUBLIC "-D_FILE_OFFSET_BITS=64") endif() diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 4cb25f6af1..d5cdc1b75b 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -101,15 +101,6 @@ 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}" MATCHES "Clang")) - wx_string_append(CMAKE_CXX_FLAGS " -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}-")