TI compiler: add automatic detection of prefix and suffixes

The TI cross compilers are named e.g. cl6x or armcl, the accompanying
strip and ar have the same prefixes/suffixes.

Alex
This commit is contained in:
Alex Neundorf
2013-03-14 19:42:03 +01:00
parent b3015862e5
commit 27e6f6ef39
3 changed files with 17 additions and 7 deletions
+7
View File
@@ -158,6 +158,13 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "TI")
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}")
set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}")
endif ()
endif()
endif ()