Skip to content

Commit

Permalink
Disabled RTTI
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Dec 8, 2024
1 parent f4800f4 commit ff33f77
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 16 additions & 8 deletions CMake/Util.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,23 @@ function(set_option target exposure option)
endfunction()

function(target_add_link_option_if_compiles target exposure flag)
CHECK_CXX_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
if(COMPILER_HAS_THOSE_TOGGLES)
target_link_options(${target_name} ${exposure} ${flag})
endif()
CHECK_CXX_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
if(COMPILER_HAS_THOSE_TOGGLES)
target_link_options(${target_name} ${exposure} ${flag})
endif()
endfunction()

function(target_add_compile_option_if_compiles target exposure flag)
CHECK_CXX_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
if(COMPILER_HAS_THOSE_TOGGLES)
target_compile_options(${target_name} ${exposure} ${flag})
endif()
CHECK_CXX_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
if(COMPILER_HAS_THOSE_TOGGLES)
target_compile_options(${target_name} ${exposure} ${flag})
endif()
endfunction()

function(pipe_target_disable_rtti target exposure)
if(COMPILER_MSVC)
target_compile_options(${target} ${exposure} /GR-)
elseif(COMPILER_CLANG OR COMPILER_GCC)
target_compile_options(${target} ${exposure} -fno-rtti)
endif()
endfunction()
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pipe_target_enable_CPP20(Pipe)
pipe_add_sanitizers(Pipe)
pipe_target_shared_output_directory(Pipe)
#pipe_target_link_time_optimization(Pipe)
pipe_target_disable_rtti(Pipe PRIVATE)


################################################################################
Expand Down

0 comments on commit ff33f77

Please sign in to comment.