1set(c23id c2x gnu2x)
2set(c17id c17 c18 gnu17 gnu18 "iso9899:2017" "iso9899:2018")
3set(c11id c11 gnu11 "iso9899:2011")
4set(c99id c99 gnu99 "iso9899:1999")
5set(c90id c89 c90 gnu89 gnu90 "iso9899:1990" "iso9899:199409")
6
7set(compile_features_list)
8
9# For each id value above a compile_features_${idval} with a list of supported
10# `c_std_XX` values are created for easy lookup.
11# For example, the settings
12# - `compile_feature_c99` will contain `c_std_90;c_std_99`
13# - `compile_feature_iso9899:2011` will contain `c_std_90;c_std_99;c_std_11`
14# that can then be used to set CMAKE_C_COMPILE_FEATURES accordingly.
15foreach(standard 90 99 11 17 23)
16  list(APPEND compile_features_list c_std_${standard})
17  foreach(id ${c${standard}id})
18    set(compile_features_${id} ${compile_features_list})
19  endforeach()
20endforeach()
21
22set(compile_features_cpp98 cxx_std_98)
23set(compile_features_cpp11 cxx_std_11 ${compile_features_cpp98})
24set(compile_features_cpp14 cxx_std_14 ${compile_features_cpp11})
25set(compile_features_cpp17 cxx_std_17 ${compile_features_cpp14})
26set(compile_features_cpp20 cxx_std_20 ${compile_features_cpp17})
27