diff options
Diffstat (limited to 'Modules/CMakeFindPackageMode.cmake')
-rw-r--r-- | Modules/CMakeFindPackageMode.cmake | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index bebf3ab..3e5cb49 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -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}) |