function(target_append_compiler_flags target_name)
  get_target_property(existing_compiler_flags ${target_name} COMPILE_OPTIONS)
  target_compile_options(${target_name} ${existing_compiler_options} ${ARGN})
endfunction()

function(target_clang_compiler_flags target_name)
  if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    target_append_compiler_flags(${target_name} ${ARGN})
  endif()
endfunction()

function(target_gcc_compiler_flags target_name)
  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_append_compiler_flags(${target_name} ${ARGN})
  endif()
endfunction()

function(target_msvc_compiler_flags target_name)
  if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    target_append_compiler_flags(${target_name} ${ARGN})
  endif()
endfunction()
