diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-05-21 14:26:39 +0200 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-05-22 00:30:56 +0200 |
| commit | a5e85627b04ed8d05ccccfaf0aac5f83ec6ace0c (patch) | |
| tree | 0c884668828985d1227bd3b95d748dde8f6767e0 /CMake | |
| parent | 7f2ea688d2b6881a071d3db86efb8825fafd3014 (diff) | |
cmake: Use Policy CMP0117 for more sensible RTTI flag configuration on MSVC.
Diffstat (limited to 'CMake')
| -rw-r--r-- | CMake/RemoveCompileFlag.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/CMake/RemoveCompileFlag.cmake b/CMake/RemoveCompileFlag.cmake new file mode 100644 index 0000000000..1bb9c167be --- /dev/null +++ b/CMake/RemoveCompileFlag.cmake @@ -0,0 +1,16 @@ +# from https://stackoverflow.com/a/49216539 +# The linked answer does some weird preconfiguring by manually splitting the CMAKE_CXX_FLAGS variable and applying it to a target, +# but as far as I can tell none of that is necessary, this works just fine as-is. + +# +# Removes the specified compile flag from the specified target. +# _target - The target to remove the compile flag from +# _flag - The compile flag to remove +# +macro(remove_cxx_flag_from_target _target _flag) + get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS) + if(_target_cxx_flags) + list(REMOVE_ITEM _target_cxx_flags ${_flag}) + set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}") + endif() +endmacro() |
