mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
Fixes: #49587 Try to detect sysroot for cross-compile toolchain if not specified by the user with `-DSYSROOT_DIR=<path>`. First, the C compiler is asked if it knows its sysroot, some C compilers are able to return the sysroot, as an example: > $ arm-none-eabi-gcc -print-sysroot > <path>/bin/../arm-none-eabi > $ but majority of gcc-based C compilers seems to return empty string: > $ arm-zephyr-eabi-gcc --print-sysroot > $ in such cases, the cross-compiler target CMake file will try to discover the sysroot by searching for libc.a, starting one level up from the compiler location. If no sysroot candidate is found, a warning will be printed to the user. If a single sysroot candidate is found, this candidate will be selected. If multiply sysroot candidates are found, a warning is printed, and the first candiate in the list is selected. User may select another candidate with `-DSYSROOT_DIR=<use-this>`. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>