CMake: Apply no-RTTI compile options directly to targets

Don't set global compile options or defines.

(cherry picked from commit 865f7aced21b03fc522b6b62b6f494221fa36cb8)
This commit is contained in:
Maarten Bent 2023-03-10 00:04:51 +01:00 committed by Vadim Zeitlin
parent b5ef8b71d3
commit 6f0ecd48f0
2 changed files with 9 additions and 9 deletions

View File

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

View File

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