Commit graph

4 commits

Author SHA1 Message Date
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
Jeremy Bettis 1fee4849bc cmake: Populate var CMAKE_GCOV
For each compiler, also set a CMAKE_GCOV var referencing the appropriate
gcov tool.

Tested with gcc and host-gcc on the ChromeOS codebase.

Signed-off-by: Jeremy Bettis <jbettis@chromium.org>
2021-09-02 19:44:00 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Sebastian Bøe a0a63ac344 cmake: Split toolchain configuration into pre-and post-DT
Split up the toolchain configuration into two phases, generic and
target. The 'generic' phase configures the toolchain just enough to be
able to preprocess DT files. The 'target' phase completes the
configuration with target-specific configuration.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-12-14 13:16:28 +01:00