summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCCompiler.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-10-20 11:32:23 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-10-25 05:01:38 (GMT)
commitb84f5c2ef17c88441844896bf4b9f1e84da4d65e (patch)
tree1e75a1642f40fab951cad6c420b8db5f1699cfec /Modules/CMakeDetermineCCompiler.cmake
parentfd818b2ff497dbe382684f59eb626956e6e79aaa (diff)
downloadCMake-b84f5c2ef17c88441844896bf4b9f1e84da4d65e.zip
CMake-b84f5c2ef17c88441844896bf4b9f1e84da4d65e.tar.gz
CMake-b84f5c2ef17c88441844896bf4b9f1e84da4d65e.tar.bz2
Find appropriate binutils when cross-compiling with clang
One way to use clang as a cross-compiler is to create a symlink named <target>-clang, which is equivalent to running clang -target <target> Extract the toolchain prefix to find the binutils executables.
Diffstat (limited to 'Modules/CMakeDetermineCCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 8769c66..a1713ce 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -154,9 +154,9 @@ endif ()
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()