zephyr/cmake/compiler/host-gcc
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
..
compiler_flags.cmake
generic.cmake cmake: provide a useful error msg when native compiler is missing 2023-02-09 22:10:16 +09:00
target.cmake