aboutsummaryrefslogtreecommitdiff
path: root/cmake/Compiler/GNUARM.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Compiler/GNUARM.cmake')
-rw-r--r--cmake/Compiler/GNUARM.cmake11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmake/Compiler/GNUARM.cmake b/cmake/Compiler/GNUARM.cmake
index ed05d92426..fc9db7a0d5 100644
--- a/cmake/Compiler/GNUARM.cmake
+++ b/cmake/Compiler/GNUARM.cmake
@@ -15,9 +15,14 @@ get_filename_component(_CMAKE_CXX_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PAT
set(CMAKE_EXECUTABLE_SUFFIX ".axf")
-find_program(CMAKE_GNUARM_LINKER arm-none-eabi-gcc HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
-find_program(CMAKE_GNUARM_AR arm-none-eabi-ar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
-find_program(CMAKE_GNUARM_OBJCOPY arm-none-eabi-objcopy HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+if(NOT DEFINED GNUARM_PREFIX)
+ get_filename_component(__c_bin ${CMAKE_C_COMPILER} NAME)
+ string(REPLACE "-gcc" "" GNUARM_PREFIX ${__c_bin})
+endif()
+
+find_program(CMAKE_GNUARM_LINKER ${GNUARM_PREFIX}-gcc HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_GNUARM_AR ${GNUARM_PREFIX}-ar HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
+find_program(CMAKE_GNUARM_OBJCOPY ${GNUARM_PREFIX}-objcopy HINTS "${_CMAKE_C_TOOLCHAIN_LOCATION}" "${_CMAKE_CXX_TOOLCHAIN_LOCATION}" )
set(CMAKE_LINKER "${CMAKE_GNUARM_LINKER}" CACHE FILEPATH "The GNUARM linker" FORCE)
mark_as_advanced(CMAKE_GNUARM_LINKER)