zephyr/samples/application_development
Jonathon Penix 4ddd3ebd51 samples: external_lib: Include `--target` in exported build flags
Appropriately setting the `--target` flag is necessary when using clang
and building for a target other than the default. Zephyr generally
accomplishes this by setting the CMAKE_<LANG>_COMPILER_TARGET variables and
allowing cmake to automatically provide the `--target` flag when building.

For the external_lib sample, however, cmake can't add the flag and it was
not otherwise exported. As such, clang typically threw errors when building
this sample for any non-default targets due to mismatches between
target-specific flags and the default target.

To fix this, ensure we select the correct target by checking if
CMAKE_C_COMPILER_TARGET has been defined and adding
`--target=<triple>` to the list of flags that are exported if so.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-07-31 10:08:33 +02:00
..
code_relocation_nocopy
external_lib
application_development.rst