summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeFindPackageMode.cmake
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-07-14 21:53:01 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-08-09 14:32:45 (GMT)
commit53edfb206b549f0dd5a014aac054ca82d865bbcd (patch)
tree6ec16e035fd3fece40f03f85f3d9d03c419b6d74 /Modules/CMakeFindPackageMode.cmake
parentb8fdaa1d662b01a167c94f2a9a9efec9dd0ea2d0 (diff)
downloadCMake-53edfb206b549f0dd5a014aac054ca82d865bbcd.zip
CMake-53edfb206b549f0dd5a014aac054ca82d865bbcd.tar.gz
CMake-53edfb206b549f0dd5a014aac054ca82d865bbcd.tar.bz2
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
Diffstat (limited to 'Modules/CMakeFindPackageMode.cmake')
-rw-r--r--Modules/CMakeFindPackageMode.cmake29
1 files changed, 26 insertions, 3 deletions
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 7e95463..bebf3ab 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -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")