[clblas] 18/75: Only use the -m32 or -m64 compiler flags on x86.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jan 24 23:30:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository clblas.

commit c716d405886dcc22d5d4e7a3681aaeb2d78f8cbb
Author: Anton Lokhmotov <anton at dividiti.com>
Date:   Mon Feb 1 12:48:27 2016 +0000

    Only use the -m32 or -m64 compiler flags on x86.
---
 src/CMakeLists.txt | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1fa849d..249b3d2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -296,9 +296,17 @@ if(CMAKE_COMPILER_IS_GNUCXX)
     # Don't use -rpath.
     set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
 
-    set(CMAKE_C_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_C_FLAGS}")
-    set(CMAKE_CXX_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_CXX_FLAGS}")
-    set(CMAKE_Fortran_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_Fortran_FLAGS}")
+    # Need to determine the target machine of the C compiler, because
+    # the '-m32' and '-m64' flags are supported on x86 but not on e.g. ARM.
+    exec_program( "${CMAKE_C_COMPILER} -dumpmachine"
+        OUTPUT_VARIABLE CMAKE_C_COMPILER_MACHINE )
+    message( STATUS "CMAKE_C_COMPILER_MACHINE: ${CMAKE_C_COMPILER_MACHINE}" )
+    # The "86" regular expression matches x86, x86_64, i686, etc.
+    if(${CMAKE_C_COMPILER_MACHINE} MATCHES "86")
+        set(CMAKE_C_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_C_FLAGS}")
+        set(CMAKE_CXX_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_CXX_FLAGS}")
+        set(CMAKE_Fortran_FLAGS "-m${TARGET_PLATFORM} ${CMAKE_Fortran_FLAGS}")
+    endif()
 
     if(TARGET_PLATFORM EQUAL 32)
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clblas.git



More information about the debian-science-commits mailing list