Source: bornagain
Tags: patch

Hi,

cmake/BornAgain/Linux.cmake currently has the following lines:
  execute_process(COMMAND uname -m OUTPUT_VARIABLE SYSCTL_OUTPUT)
  if(${SYSCTL_OUTPUT} MATCHES x86_64)
      message(STATUS "Found a 64bit system")
      set(BIT_ENVIRONMENT "-m64")
      set(BORNAGAIN_ARCHITECTURE linuxx8664)
  else()
      message(STATUS "Found a 32bit system")
      set(BIT_ENVIRONMENT "-m32")
      add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY=1)
  endif()

This has the following affects:
  * It stops cross building since it reads build's `uname`.
  * It stops building for most non-amd64 64-bit archs since it doesn't
recognize them as 64-bit archs.
  * It stops building for most non-i386 archs since they don't accept `-m32`.

Please consider applying this patch.
diff --git a/cmake/BornAgain/Linux.cmake b/cmake/BornAgain/Linux.cmake
index 2f482ee..98f67a5 100644
--- a/cmake/BornAgain/Linux.cmake
+++ b/cmake/BornAgain/Linux.cmake
@@ -1,14 +1,13 @@
 set(BORNAGAIN_ARCHITECTURE linux)
 set(BORNAGAIN_PLATFORM linux)
 
-execute_process(COMMAND uname -m OUTPUT_VARIABLE SYSCTL_OUTPUT)
-if(${SYSCTL_OUTPUT} MATCHES x86_64)
+if(CMAKE_SIZEOF_VOID_P GREATER 4)
     message(STATUS "Found a 64bit system")
-    set(BIT_ENVIRONMENT "-m64")
-    set(BORNAGAIN_ARCHITECTURE linuxx8664)
+    if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
+        set(BORNAGAIN_ARCHITECTURE linuxx8664)
+    endif()
 else()
     message(STATUS "Found a 32bit system")
-    set(BIT_ENVIRONMENT "-m32")
     add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY=1)
 endif()
 

Reply via email to