zephyr/cmake/compiler/gcc
Marc Herbert 3ebb18b882 cmake: fix utterly cryptic error handling in the -DSPARSE=y build
Fixes commit 7a85ff7683 ("add sparse support")

The sparse build needs (at least) two things:
1. sparse to be in the PATH
2. the environment variable REAL_CC to be defined and to match the
   value expected by CMake

Fix error messages when either condition is wrong.

- New error message when 1. is not satisfied:
```
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:12 (find_program):
  Could not find CMAKE_C_COMPILER using the following names: cgcc
```

- Previous error "message" when 1. is not satisfied:
```
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:17 (message):
  C compiler
  ZSDK/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc
  not found - Please check your toolchain installation
```
Note the "not found" cross-compiler actually exists!

- New error message when 2. is not satisfied:
```
Kconfig header saved to 'ws/build-tgl/zephyr/include/generated/autoconf.h'
-- Found sparse: /home/user/sparse/cgcc
CMake Error at ws/zephyr/cmake/compiler/gcc/target.cmake:25 (message):
  The only way to override its 'cc' default when cross-compiling with
  sparse is unfortunately an environment variable.  So you _must_ set
  REAL_CC at both configuration time and build time to:
  $ZSDK/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc

```

- Previous error "message" when 2. is not satisfied:
```
modules/hal/xtensa/include/xtensa/config/core.h:54:10:
    error:unable to open 'core-isa.h'`
```

Also: stop using the same name REAL_CC for both the internal CMake
variable and the external sparse parameter; they're two different
things so name them differently. Environment variable messes are
complicated enough.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-22 15:12:22 +00:00
..
compiler_flags.cmake cmake: test format options together 2022-09-14 09:37:59 +00:00
generic.cmake cmake: Populate var CMAKE_GCOV 2021-09-02 19:44:00 -04:00
target_arc.cmake compiler: gcc: add support for tuning mcpu option for ARC targets 2022-09-08 10:39:21 +02:00
target_arm64.cmake
target_arm.cmake arch: introduce config DCLS 2022-08-04 12:51:25 +09:00
target_mips.cmake cmake: add MIPS support 2022-01-19 13:48:21 -05:00
target_riscv.cmake riscv: Introduce BitManip extensions 2022-08-29 16:57:18 +02:00
target_sparc.cmake
target_x86.cmake
target.cmake cmake: fix utterly cryptic error handling in the -DSPARSE=y build 2022-09-22 15:12:22 +00:00