BUG: #7359 make llvm-gcc work, by explicitely excluding "llvm-" from _CMAKE_TOOLCHAIN_PREFIX

(use the (relatively) new CMAKE_MATCH_x variables set by all regex operations)

Alex
This commit is contained in:
Alexander Neundorf 2008-09-07 16:54:01 -04:00
parent c2cc883430
commit 281e441100
2 changed files with 16 additions and 2 deletions

View File

@ -97,8 +97,15 @@ ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
IF (NOT _CMAKE_TOOLCHAIN_PREFIX) IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$") IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
STRING(REGEX REPLACE "^(.+-)g?cc(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}") SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$") ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)

View File

@ -97,8 +97,15 @@ ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
IF (NOT _CMAKE_TOOLCHAIN_PREFIX) IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$") IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$")
STRING(REGEX REPLACE "^(.+-)[gc]\\+\\+(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}") SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$") ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$")
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
IF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
ENDIF ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
# This block was used before the compiler was identified by building a # This block was used before the compiler was identified by building a