summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.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/CMakeDetermineCXXCompiler.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/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index c79ba89..d28aa2c 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -152,9 +152,9 @@ endif ()
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
endif ()