summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/ARMCC.cmake
diff options
context:
space:
mode:
authorJoakim Andersson <Joakim.Andersson@nordicsemi.no>2015-10-26 13:51:09 (GMT)
committerBrad King <brad.king@kitware.com>2015-11-02 18:45:24 (GMT)
commit035a658f4fdc8028ff19568aa2ded8b3efa70909 (patch)
tree133d05ec37b5f5b2632111186d0bc0a52aabdc3b /Modules/Compiler/ARMCC.cmake
parent74ea66850c99578d7d1665e64579279a6ff89896 (diff)
downloadCMake-035a658f4fdc8028ff19568aa2ded8b3efa70909.zip
CMake-035a658f4fdc8028ff19568aa2ded8b3efa70909.tar.gz
CMake-035a658f4fdc8028ff19568aa2ded8b3efa70909.tar.bz2
Add support for the ARM Compiler (arm.com)
Create an `ARMCC` compiler id corresponding to compilers identified and versioned by the `__ARMCC_VERSION` predefined macro. See documentation for the compilers at http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html
Diffstat (limited to 'Modules/Compiler/ARMCC.cmake')
-rw-r--r--Modules/Compiler/ARMCC.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/Modules/Compiler/ARMCC.cmake b/Modules/Compiler/ARMCC.cmake
new file mode 100644
index 0000000..3cf628c
--- /dev/null
+++ b/Modules/Compiler/ARMCC.cmake
@@ -0,0 +1,36 @@
+if(_ARMCC_CMAKE_LOADED)
+ return()
+endif()
+set(_ARMCC_CMAKE_LOADED TRUE)
+
+# See ARM Compiler documentation at:
+# http://infocenter.arm.com/help/topic/com.arm.doc.set.swdev/index.html
+
+get_filename_component(_CMAKE_C_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
+get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
+
+set(CMAKE_EXECUTABLE_SUFFIX ".elf")
+
+find_program(CMAKE_ARMCC_LINKER armlink HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_ARMCC_AR armar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+
+set(CMAKE_LINKER "${CMAKE_ARMCC_LINKER}" CACHE FILEPATH "The ARMCC linker" FORCE)
+mark_as_advanced(CMAKE_ARMCC_LINKER)
+set(CMAKE_AR "${CMAKE_ARMCC_AR}" CACHE FILEPATH "The ARMCC archiver" FORCE)
+mark_as_advanced(CMAKE_ARMCC_AR)
+
+macro(__compiler_armcc lang)
+ set(CMAKE_${lang}_FLAGS_INIT "")
+ set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-Otime -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+ set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
+ set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+
+ set(CMAKE_DEPFILE_FLAGS_${lang} "--depend=<DEPFILE> --depend_single_line --no_depend_system_headers")
+endmacro()