[Cmake-commits] CMake branch, next, updated. v2.8.9-357-gbbad3d0

Alexander Neundorf neundorf at kde.org
Tue Sep 4 15:11:54 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  bbad3d0946f72c3cd86e00d7de1bbccfe9d87c44 (commit)
       via  e2d317052b2bbdede263f693ecde4a86a6149abf (commit)
      from  ed59e13b0f44cfe482093a5b10548e11bf5ff06d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bbad3d0946f72c3cd86e00d7de1bbccfe9d87c44
commit bbad3d0946f72c3cd86e00d7de1bbccfe9d87c44
Merge: ed59e13 e2d3170
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Tue Sep 4 15:11:52 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Sep 4 15:11:52 2012 -0400

    Merge topic 'FortranCrossCompiling3' into next
    
    e2d3170 CMakeDetermineFortranCompiler: add support for cross-compiling (#13379)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2d317052b2bbdede263f693ecde4a86a6149abf
commit e2d317052b2bbdede263f693ecde4a86a6149abf
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Tue Sep 4 21:10:02 2012 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Tue Sep 4 21:10:02 2012 +0200

    CMakeDetermineFortranCompiler: add support for cross-compiling (#13379)
    
    This adds the same support code for cross compiling to
    CMakeDetermineFortranCompiler as there is already in the
    C and CXX versions of this file.
    
    Alex

diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 051f832..1828988 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -134,6 +134,10 @@ else()
     )
 endif()
 
+if (NOT _CMAKE_TOOLCHAIN_LOCATION)
+  get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Fortran_COMPILER}" PATH)
+endif ()
+
 # Build a small source file to identify the compiler.
 if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
   set(CMAKE_Fortran_COMPILER_ID_RUN 1)
@@ -189,6 +193,28 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
   endif()
 endif()
 
+# if we have a fortran cross compiler, they have usually some prefix, like
+# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , 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
+# 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_Fortran_COMPILER_ID}" MATCHES "GNU"
+    AND NOT _CMAKE_TOOLCHAIN_PREFIX)
+  get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)
+  if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+    set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+  endif ()
+
+  # 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 ()
+endif ()
+
 include(CMakeFindBinUtils)
 
 if(MSVC_Fortran_ARCHITECTURE_ID)

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeDetermineFortranCompiler.cmake |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list