zephyr/cmake/compiler
Torsten Rasmussen 917d5021d7 cmake: CMake compile features support
Fixes: #36558 #32577

This commit introduces CMAKE_C_COMPILE_FEATURES and
CMAKE_CXX_COMPILE_FEATURES.

This allows users to use the `target_compile_features()` in their own
code.

In Zephyr, the CMAKE_C/CXX_COMPILE_FEATURES are defined based on the
compiler and the Kconfig / CSTD setting.
Doing so ensures that a user compiling Zephyr with c99 and specifies
`target_compile_features(<target> ... c_std_11)` will get an error.
And similar if building Zephyr with C++ support and c++11, but testing
for `target_compile_features(<target> ... cxx_std_17)`.

For example in the C++ case, the user must ensure that Zephyr is
compiled with C++17, that is: CPLUSPLUS=y and STD_CPP17=y, in which case
the CMAKE_CXX_COMPILE_FEATURES will contain support for C++17 and thus
the `target_compile_features(<target> ... cxx_std_17)` will succeed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-01 14:40:33 -04:00
..
arcmwdt cmake: Populate var CMAKE_GCOV 2021-09-02 19:44:00 -04:00
armclang armclang: ARM Compiler C library support 2021-08-30 08:54:23 -04:00
clang cmake: Populate var CMAKE_GCOV 2021-09-02 19:44:00 -04:00
gcc cmake: compiler: Add nostdincxx property for gcc 2021-09-21 11:39:18 -04:00
host-gcc cmake: Populate var CMAKE_GCOV 2021-09-02 19:44:00 -04:00
icx
xcc cmake/compiler/xcc: sched: Support XCC inlining semantics 2021-09-08 09:28:31 -04:00
compiler_features.cmake cmake: CMake compile features support 2021-10-01 14:40:33 -04:00
compiler_flags_template.cmake cmake: compiler: Add framework for disabling C++ standard includes 2021-09-21 11:39:18 -04:00