[Cmake-commits] [cmake-commits] alex committed CMakeDetermineCXXCompiler.cmake 1.47 1.48 CMakeDetermineCCompiler.cmake 1.54 1.55

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Sep 8 17:43:33 EDT 2008


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv16770

Modified Files:
	CMakeDetermineCXXCompiler.cmake CMakeDetermineCCompiler.cmake 
Log Message:
BUG: only check for a toolchain prefix (e.g. "arm-linux-" in
"arm-linux-gcc") if we are cross compiling and the compiler is gcc

Alex


Index: CMakeDetermineCXXCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCXXCompiler.cmake,v
retrieving revision 1.47
retrieving revision 1.48
diff -C 2 -d -r1.47 -r1.48
*** CMakeDetermineCXXCompiler.cmake	7 Sep 2008 20:54:01 -0000	1.47
--- CMakeDetermineCXXCompiler.cmake	8 Sep 2008 21:43:31 -0000	1.48
***************
*** 89,112 ****
  ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
  
- # 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++
- # 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
- # "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-"
- IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
-   GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
-   IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$")
-     SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
-   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)
- 
  # This block was used before the compiler was identified by building a
  # source file.  Unless g++ crashes when building a small C++
--- 89,92 ----
***************
*** 159,162 ****
--- 139,166 ----
  ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
  
+ # 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++
+ # 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
+ # "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-"
+ IF (CMAKE_CROSSCOMPILING  
+     AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
+     AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+   GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
+   IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(\\.exe)?$")
+     SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+   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 (CMAKE_CROSSCOMPILING  
+     AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"
+     AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+ 
  INCLUDE(CMakeFindBinUtils)
  

Index: CMakeDetermineCCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCCompiler.cmake,v
retrieving revision 1.54
retrieving revision 1.55
diff -C 2 -d -r1.54 -r1.55
*** CMakeDetermineCCompiler.cmake	7 Sep 2008 20:54:01 -0000	1.54
--- CMakeDetermineCCompiler.cmake	8 Sep 2008 21:43:31 -0000	1.55
***************
*** 89,113 ****
  ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION)
  
- # 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 .
- # 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
- # "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-"
- IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
-   GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
-   IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
-     SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
-   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)
- 
- 
  # Build a small source file to identify the compiler.
  IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
--- 89,92 ----
***************
*** 149,152 ****
--- 128,158 ----
  ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
  
+ # 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 .
+ # 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
+ # "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-"
+ IF (CMAKE_CROSSCOMPILING  
+     AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
+     AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+   GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
+   IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(\\.exe)?$")
+     SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+   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 (CMAKE_CROSSCOMPILING  
+     AND "${CMAKE_C_COMPILER_ID}" MATCHES "GNU"
+     AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+ 
+ 
+ 
+ 
  INCLUDE(CMakeFindBinUtils)
  



More information about the Cmake-commits mailing list