Better support for lib64 and Debian multiarch

If CMAKE_SIZEOF_VOID_P is not set from the outside, it checks for the
existance of /usr/lib64, and if it exists, SIZEOF_VOID_P is set to 8.

For multiarch, if this is debian and
CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE has not been set, it globs
for the files in /lib, and uses the first one which matches
CMAKE_LIBRARY_ARCHITECTURE_REGEX.

Alex
This commit is contained in:
Alex Neundorf 2011-07-14 23:53:01 +02:00
parent b8fdaa1d66
commit 53edfb206b
1 changed files with 26 additions and 3 deletions

View File

@ -40,9 +40,32 @@ include(CMakeDetermineSystem)
# This makes the FIND_XXX() calls work much better
include(CMakeSystemSpecificInformation)
# this is ugly, and not enough for the multilib-stuff I guess
if(UNIX AND EXISTS /usr/lib64)
set(CMAKE_SIZEOF_VOID_P 8)
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)
if(EXISTS /usr/lib64)
set(CMAKE_SIZEOF_VOID_P 8)
else()
set(CMAKE_SIZEOF_VOID_P 4)
endif()
endif()
# guess Debian multiarch if it has not been set:
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})
break()
endif()
endforeach()
endif()
endif()
endif()
set(CMAKE_${LANGUAGE}_COMPILER "dummy")