zephyr/cmake
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
..
app cmake: remove policy CMP0079 old behavior 2021-09-22 09:40:07 -04:00
bintools cmake: gnu: Fix debugging when GDB fails to load because of Python 2021-09-23 12:47:39 +02:00
compiler cmake: CMake compile features support 2021-10-01 14:40:33 -04:00
emu boards: fvp_base_revc_2xaemv8a: permit running Zephyr at EL1NS 2021-09-06 14:11:32 -04:00
flash scripts: runners: openocd: Enable thread awareness 2021-08-27 06:44:45 -04:00
ide license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
linker cmake: linker generator: group symbol from section 2021-09-24 15:13:13 -04:00
linker_script cmake: linker: arm: utilize zephyr_linker_group(... SYMBOL SECTION) 2021-09-24 15:13:13 -04:00
makefile_exports cmake: using zephyr_get_compile_options_for_lang_as_string for export 2020-12-15 08:37:54 -05:00
reports build: reports: publish all reports 2021-07-21 14:54:30 +03:00
toolchain toolchain: esp32: define target toolchain 2021-09-28 20:06:25 -04:00
usage boards/shields: re-work handling in cmake and west 2021-01-15 15:07:49 -05:00
util license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
boards.cmake cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
ccache.cmake license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
cfb.cmake cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE} 2020-03-27 16:23:46 +01:00
dts.cmake cmake: dts: import devicetree symbols into CMake 2021-08-25 20:28:26 -04:00
extensions.cmake cmake: linker generator: group symbol from section 2021-09-24 15:13:13 -04:00
extra_flags.cmake cmake: extra_flags: fix EXTRA_CPPFLAGS being applied as macros 2019-12-13 13:23:40 -05:00
gcc-m-cpu.cmake arch: arm: cortex_m: Add ARMv8.1-M MVE configs 2021-08-14 20:29:57 -04:00
generic_toolchain.cmake cmake: twister: Using common script for toolchain setting verification 2021-02-04 20:05:05 -05:00
git.cmake cmake: cleanup version printing during CMake configure time 2021-05-07 20:50:02 -04:00
hex.cmake license: cleanup: add SPDX Apache-2.0 license identifier 2019-04-07 08:45:22 -04:00
host-tools.cmake cmake: add IMGTOOL optional dependency 2020-09-01 13:33:46 +02:00
kconfig.cmake armclang: ARM Compiler C library support 2021-08-30 08:54:23 -04:00
kobj.cmake cmake: improved handling of output and byproducts in CMake 2021-02-14 18:09:24 -05:00
mcuboot.cmake kconfig: Add option for encryption of binaries 2021-08-26 21:15:54 -04:00
pristine.cmake cmake: pristine.cmake requires SOURCE_DIR and BINARY_DIR as arguments 2021-01-23 08:31:13 -05:00
python.cmake cmake: use WEST_PYTHON as a preferred python installation if defined. 2021-04-27 13:31:23 -04:00
shields.cmake boards/shields: re-work handling in cmake and west 2021-01-15 15:07:49 -05:00
target_toolchain.cmake scripts: gen_handles.py: take device start symbol as argument. 2021-08-30 08:54:23 -04:00
target_toolchain_flags.cmake cmake: CMake compile features support 2021-10-01 14:40:33 -04:00
verify-toolchain.cmake cmake: Set minimum required Zephyr SDK version to 0.13.1 2021-09-24 07:35:40 -04:00
version.cmake cmake: cleanup version printing during CMake configure time 2021-05-07 20:50:02 -04:00
west.cmake cmake: west: do not print error if west topdir fails 2021-03-17 11:28:14 +01:00
zephyr_module.cmake cmake: add a comment header to zephyr_settings.txt 2021-08-10 07:37:19 -04:00