include(CheckCXXCompilerFlag) function(sls_add_flag_if_available flag target) check_cxx_compiler_flag(${flag} flag_supported) if(flag_supported) target_compile_options(${target} INTERFACE ${flag}) message("Adding: ${flag} to ${target}") else() message("Flag: ${flag} not supported") endif() endfunction()