| 1 |
# from https://stackoverflow.com/a/49216539 |
| 2 |
# The linked answer does some weird preconfiguring by manually splitting the CMAKE_CXX_FLAGS variable and applying it to a target, |
| 3 |
# but as far as I can tell none of that is necessary, this works just fine as-is. |
| 4 |
|
| 5 |
# |
| 6 |
# Removes the specified compile flag from the specified target. |
| 7 |
# _target - The target to remove the compile flag from |
| 8 |
# _flag - The compile flag to remove |
| 9 |
# |
| 10 |
macro(remove_cxx_flag_from_target _target _flag) |
| 11 |
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS) |
| 12 |
if(_target_cxx_flags) |
| 13 |
list(REMOVE_ITEM _target_cxx_flags ${_flag}) |
| 14 |
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}") |
| 15 |
endif() |
| 16 |
endmacro() |