CMake/Modules/Compiler/GNU-C.cmake
Tyler 4d27ef55bd Modules: Factor out helpers for GNU language standard flags
Add the following macros to `${CMAKE_ROOT}\Modules\Compiler\GNU.cmake`:

* `__compiler_gnu_c_standards()`
* `__compiler_gnu_cxx_standards()`

These macros are used to define the
`CMAKE_<LANG><STANDARD>_STANDARD_COMPILE_OPTION` and
`CMAKE_<LANG><STANDARD>_EXTENSION_COMPILE_OPTION` variables for C-
and C++-based languages for GCC. The macros are similar to the
existing `__compiler_clang_cxx_standards()` macro found in
`${CMAKE_ROOT}\Modules\Compiler\Clang.cmake`.
2024-03-29 14:27:20 -06:00

17 lines
484 B
CMake

include(Compiler/GNU)
__compiler_gnu(C)
__compiler_gnu_c_standards(C)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
AND CMAKE_DEPFILE_FLAGS_C)
# dependencies are computed by the compiler itself
set(CMAKE_C_DEPFILE_FORMAT gcc)
set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
endif()
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17)