zephyr/cmake/compiler
Marc Herbert 774330f3fa cmake: provide a useful error msg when native compiler is missing
This avoids a cryptic DTC failure when compiling trying to compile
native_posix with a missing gcc or clang.

REQUIRED is available since CMake 3.18

Example with clang, cryptic error without this commit:

```
ZEPHYR_TOOLCHAIN_VARIANT=llvm west build            \
        -p -b native_posix samples/hello_world/
-- Found toolchain: host (clang/ld)    <= this is wrong
-- Found Dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum ...
-- Found BOARD.dts: zephyr/boards/posix/native_posix/native_posix.dts
CMake Error at /zephyr/cmake/modules/dts.cmake:191 (message):
  command failed with return code: No such file or directory
Call Stack (most recent call first):
  zephyr/cmake/modules/zephyr_default.cmake:113 (include)
  zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boil...
  CMakeLists.txt:5 (find_package)
```

Well hidden behind the scenes, dts.cmake fails above because it invokes
`CMAKE_C_COMPILER-NOTFOUND`

With this commit:

```
ZEPHYR_TOOLCHAIN_VARIANT=llvm west build            \
        -p -b native_posix samples/hello_world/
-- Found toolchain: host (clang/ld)    <= this is still wrong
CMake Error at zephyr/cmake/compiler/clang/generic.cmake:7 (find_program):
  Could not find CMAKE_C_COMPILER using the following names: clang
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-02-09 22:10:16 +09:00
..
arcmwdt build: userspace: No merge globals 2023-01-26 14:56:10 -05:00
armclang cmake: gcc: target_arm: Support advanced floating-point options 2022-05-05 12:03:27 +09:00
clang cmake: provide a useful error msg when native compiler is missing 2023-02-09 22:10:16 +09:00
gcc cmake: sparse: deprecate old sparse support 2023-01-27 20:28:58 +09:00
host-gcc cmake: provide a useful error msg when native compiler is missing 2023-02-09 22:10:16 +09:00
icx
xcc treewide: Use CONFIG_CPP instead of CONFIG_CPLUSPLUS 2023-01-13 17:42:55 -05:00
xcc-clang xcc-clang: Do not used unavailable options 2022-08-23 10:13:43 +02:00
compiler_features.cmake
compiler_flags_template.cmake build: userspace: No merge globals 2023-01-26 14:56:10 -05:00