Merge topic 'FixParsingCompilerNameWithVersionNumber'
5883c51
Fix parsing of compiler name with a version numberbd57bc5
Strip trailing whitespace.
This commit is contained in:
commit
7c4e57c821
|
@ -81,16 +81,17 @@ ENDIF()
|
||||||
|
|
||||||
|
|
||||||
# If we have a gas/as cross compiler, they have usually some prefix, like
|
# If we have a gas/as cross compiler, they have usually some prefix, like
|
||||||
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas .
|
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
|
||||||
|
# with a 3-component version number at the end
|
||||||
# The other tools of the toolchain usually have the same prefix
|
# The other tools of the toolchain usually have the same prefix
|
||||||
# NAME_WE cannot be used since then this test will fail for names lile
|
# NAME_WE cannot be used since then this test will fail for names lile
|
||||||
# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be
|
# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be
|
||||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||||
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
||||||
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(\\.exe)?$")
|
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}")
|
STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}")
|
||||||
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(\\.exe)?$")
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||||
|
|
||||||
INCLUDE(CMakeFindBinUtils)
|
INCLUDE(CMakeFindBinUtils)
|
||||||
|
|
|
@ -144,7 +144,8 @@ IF(NOT CMAKE_C_COMPILER_ID_RUN)
|
||||||
ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
|
ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
|
||||||
|
|
||||||
# If we have a gcc cross compiler, they have usually some prefix, like
|
# If we have a gcc cross compiler, they have usually some prefix, like
|
||||||
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc .
|
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally
|
||||||
|
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||||
# The other tools of the toolchain usually have the same prefix
|
# The other tools of the toolchain usually have the same prefix
|
||||||
# NAME_WE cannot be used since then this test will fail for names lile
|
# NAME_WE cannot be used since then this test will fail for names lile
|
||||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||||
|
@ -153,9 +154,9 @@ IF (CMAKE_CROSSCOMPILING
|
||||||
AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
|
AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
|
||||||
AND NOT _CMAKE_TOOLCHAIN_PREFIX)
|
AND 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(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||||
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
|
||||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
# 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.)
|
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||||
|
|
|
@ -152,8 +152,9 @@ IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
||||||
ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
||||||
|
|
||||||
# if we have a g++ cross compiler, they have usually some prefix, like
|
# if we have a g++ cross compiler, they have usually some prefix, like
|
||||||
# e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++
|
# e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally
|
||||||
# the other tools of the toolchain usually have the same prefix
|
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||||
|
# The other tools of the toolchain usually have the same prefix
|
||||||
# NAME_WE cannot be used since then this test will fail for names lile
|
# NAME_WE cannot be used since then this test will fail for names lile
|
||||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||||
|
@ -161,9 +162,9 @@ IF (CMAKE_CROSSCOMPILING
|
||||||
AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
|
AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
|
||||||
AND NOT _CMAKE_TOOLCHAIN_PREFIX)
|
AND 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]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||||
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$")
|
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||||
|
|
||||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
# 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.)
|
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||||
|
|
Loading…
Reference in New Issue