generic.cmake 1004 B

12345678910111213141516171819202122232425262728293031
  1. # SPDX-License-Identifier: Apache-2.0
  2. # CROSS_COMPILE is a KBuild mechanism for specifying an external
  3. # toolchain with a single environment variable.
  4. #
  5. # It is a legacy mechanism that will in Zephyr translate to
  6. # specififying ZEPHYR_TOOLCHAIN_VARIANT to 'cross-compile' with the location
  7. # 'CROSS_COMPILE'.
  8. #
  9. # New users should set the env var 'ZEPHYR_TOOLCHAIN_VARIANT' to
  10. # 'cross-compile' and the 'CROSS_COMPILE' env var to the toolchain
  11. # prefix. This interface is consistent with the other non-"Zephyr SDK"
  12. # toolchains.
  13. #
  14. # It can be set from either the environment or from a CMake variable
  15. # of the same name.
  16. #
  17. # The env var has the lowest precedence.
  18. if((NOT (DEFINED CROSS_COMPILE)) AND (DEFINED ENV{CROSS_COMPILE}))
  19. set(CROSS_COMPILE $ENV{CROSS_COMPILE})
  20. endif()
  21. set( CROSS_COMPILE ${CROSS_COMPILE} CACHE PATH "")
  22. assert(CROSS_COMPILE "CROSS_COMPILE is not set")
  23. set(COMPILER gcc)
  24. set(LINKER ld)
  25. set(BINTOOLS gnu)
  26. message(STATUS "Found toolchain: cross-compile (${CROSS_COMPILE})")