The seL4 microkernel https://sel4.systems/

gcc.cmake 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #
  2. # Copyright 2017, Data61
  3. # Commonwealth Scientific and Industrial Research Organisation (CSIRO)
  4. # ABN 41 687 119 230.
  5. #
  6. # This software may be distributed and modified according to the terms of
  7. # the GNU General Public License version 2. Note that NO WARRANTY is provided.
  8. # See "LICENSE_GPLv2.txt" for details.
  9. #
  10. # @TAG(DATA61_GPL)
  11. #
  12. cmake_minimum_required(VERSION 3.7.2)
  13. set(CMAKE_SYSTEM_NAME Generic)
  14. # For a generic system this is unused, so define it to something that will be
  15. # obvious if someone accidentally uses it
  16. set(CMAKE_SYSTEM_PROCESSOR seL4CPU)
  17. set(CMAKE_SYSROOT "${CMAKE_BINARY_DIR}")
  18. set(CMAKE_STAGING_PREFIX "${CMAKE_BINARY_DIR}/staging")
  19. if("${CROSS_COMPILER_PREFIX}" STREQUAL "")
  20. if(AARCH32 OR ARM)
  21. set(CROSS_COMPILER_PREFIX "arm-linux-gnueabi-" CACHE INTERNAL "")
  22. if(ARM)
  23. message("ARM flag is deprecated, please use AARCH32")
  24. endif()
  25. elseif(AARCH32HF)
  26. set(CROSS_COMPILER_PREFIX "arm-linux-gnueabihf-" CACHE INTERNAL "")
  27. elseif(AARCH64)
  28. set(CROSS_COMPILER_PREFIX "aarch64-linux-gnu-" CACHE INTERNAL "")
  29. elseif(RISCV32)
  30. set(CROSS_COMPILER_PREFIX "riscv32-unknown-elf-" CACHE INTERNAL "")
  31. elseif(RISCV64)
  32. set(CROSS_COMPILER_PREFIX "riscv64-unknown-elf-" CACHE INTERNAL "")
  33. else()
  34. # If we haven't set a target above we assume x86_64/ia32 target
  35. if(APPLE)
  36. # APPLE is a CMake variable that evaluates to True on a Mac OSX system
  37. set(CROSS_COMPILER_PREFIX "x86_64-unknown-linux-gnu-" CACHE INTERNAL "")
  38. endif()
  39. endif()
  40. endif()
  41. set(CMAKE_C_COMPILER ${CROSS_COMPILER_PREFIX}gcc)
  42. set(CMAKE_ASM_COMPILER ${CROSS_COMPILER_PREFIX}gcc)
  43. set(CMAKE_CXX_COMPILER ${CROSS_COMPILER_PREFIX}g++)
  44. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  45. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  46. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  47. set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  48. set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
  49. mark_as_advanced(FORCE CMAKE_TOOLCHAIN_FILE)