ARMCC.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. if(_ARMCC_CMAKE_LOADED)
  2. return()
  3. endif()
  4. set(_ARMCC_CMAKE_LOADED TRUE)
  5. # See ARM Compiler documentation at:
  6. # http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html
  7. get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
  8. get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
  9. set(CMAKE_EXECUTABLE_SUFFIX ".elf")
  10. find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
  11. find_program(CMAKE_ARMCC_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
  12. set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
  13. mark_as_advanced(CMAKE_ARMCC_LINKER)
  14. set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
  15. mark_as_advanced(CMAKE_ARMCC_AR)
  16. macro(__compiler_armcc lang)
  17. string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
  18. string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
  19. string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Ospace -DNDEBUG")
  20. string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -Otime -DNDEBUG")
  21. string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g")
  22. set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
  23. set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
  24. set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "--via=")
  25. set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
  26. set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
  27. set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
  28. set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ")
  29. endmacro()