Use the file-utility to test for 64bit if there is no /usr/lib64

Alex
This commit is contained in:
Alex Neundorf 2011-07-18 21:40:45 +02:00
parent 53edfb206b
commit b0e357824c
1 changed files with 9 additions and 2 deletions

View File

@ -45,10 +45,18 @@ if(UNIX)
# try to guess whether we have a 64bit system, if it has not been set
# from the outside
if(NOT CMAKE_SIZEOF_VOID_P)
set(CMAKE_SIZEOF_VOID_P 4)
if(EXISTS /usr/lib64)
set(CMAKE_SIZEOF_VOID_P 8)
else()
set(CMAKE_SIZEOF_VOID_P 4)
# use the file utility to check whether itself is 64 bit:
find_program(FILE_EXECUTABLE file)
if(FILE_EXECUTABLE)
execute_process(COMMAND "${FILE_EXECUTABLE}" "${FILE_EXECUTABLE}" OUTPUT_VARIABLE fileOutput ERROR_QUIET)
if("${fileOutput}" MATCHES "64-bit")
set(CMAKE_SIZEOF_VOID_P 8)
endif()
endif()
endif()
endif()
@ -56,7 +64,6 @@ if(UNIX)
if(EXISTS /etc/debian_version)
if(NOT CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE )
file(GLOB filesInLib RELATIVE /lib /lib/*-linux-gnu* )
list(APPEND filesInLib i386-linux-gnu)
foreach(file ${filesInLib})
if("${file}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
set(CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE ${file})