zephyr/cmake/compiler
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
..
arcmwdt compiler: arcmwdt: Add ccac version checking 2022-09-20 09:02:38 +00:00
armclang cmake: gcc: target_arm: Support advanced floating-point options 2022-05-05 12:03:27 +09:00
clang cmake: filter not supported C++ compilation flags 2022-07-07 10:26:22 +00:00
gcc cmake: fix utterly cryptic error handling in the -DSPARSE=y build 2022-09-22 15:12:22 +00:00
host-gcc cmake: Populate var CMAKE_GCOV 2021-09-02 19:44:00 -04:00
icx
xcc cmake: fix use of unsupported -fno-pie with xcc 2022-08-29 08:40:29 -04:00
xcc-clang xcc-clang: Do not used unavailable options 2022-08-23 10:13:43 +02:00
compiler_features.cmake cmake: CMake compile features support 2021-10-01 14:40:33 -04:00
compiler_flags_template.cmake xcc-clang: Do not used unavailable options 2022-08-23 10:13:43 +02:00