summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-05 15:59:35 (GMT)
committerBrad King <brad.king@kitware.com>2014-09-05 16:06:27 (GMT)
commit72d6681826840c0a14be61d19c71a55f280d38ae (patch)
tree4140cdc3c9ffb29bc6cb9882cd4530dd6dbb2870 /Modules/CMakeDetermineCXXCompiler.cmake
parent55d6aa36a522f2dd7849ccd53d9e743a88f8c7a1 (diff)
downloadCMake-72d6681826840c0a14be61d19c71a55f280d38ae.zip
CMake-72d6681826840c0a14be61d19c71a55f280d38ae.tar.gz
CMake-72d6681826840c0a14be61d19c71a55f280d38ae.tar.bz2
Fix finding binutils when cross-compiling with Clang
Since commit v3.0.0-rc1~342^2~2 (Add compiler target compile options, 2013-05-19) we use CMAKE_<LANG>_COMPILER_TARGET as the binutils prefix when cross-compiling with Clang. Fix the implementation to use the compiler target as the prefix only when it is set. Otherwise toolchain files not using CMAKE_<LANG>_COMPILER_TARGET cause the logic to use a prefix of just "-" and of course cannot find "-ar" or "-ld".
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index ef8445e..9af1de1 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -133,7 +133,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
+ if(CMAKE_CXX_COMPILER_TARGET)
+ set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
+ endif()
elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$")
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)