GNUInstallDirs: add support for Debian multiarch

This patch makes CMAKE_INSTALL_LIBDIR default to the debian
multiarch dir if present, e.g. lib/i386-linux-gnu/

Alex
This commit is contained in:
Alex Neundorf 2011-12-14 19:24:28 +01:00
parent 4ed1769186
commit 43f83d2ee5
1 changed files with 18 additions and 12 deletions

View File

@ -11,7 +11,7 @@
# SYSCONFDIR - read-only single-machine data (etc) # SYSCONFDIR - read-only single-machine data (etc)
# SHAREDSTATEDIR - modifiable architecture-independent data (com) # SHAREDSTATEDIR - modifiable architecture-independent data (com)
# LOCALSTATEDIR - modifiable single-machine data (var) # LOCALSTATEDIR - modifiable single-machine data (var)
# LIBDIR - object code libraries (lib or lib64) # LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
# INCLUDEDIR - C header files (include) # INCLUDEDIR - C header files (include)
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include) # OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
# DATAROOTDIR - read-only architecture-independent data root (share) # DATAROOTDIR - read-only architecture-independent data root (share)
@ -75,11 +75,16 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
# - we are NOT on debian # - we are NOT on debian
# - we are on a 64 bits system # - we are on a 64 bits system
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# Note that the future of multi-arch handling may be even # For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# more complicated than that: http://wiki.debian.org/Multiarch # CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# See http://wiki.debian.org/Multiarch
if(CMAKE_SYSTEM_NAME MATCHES "Linux" if(CMAKE_SYSTEM_NAME MATCHES "Linux"
AND NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING)
AND NOT EXISTS "/etc/debian_version") if (EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
if(NOT DEFINED CMAKE_SIZEOF_VOID_P) if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
@ -90,6 +95,7 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
endif() endif()
endif() endif()
endif() endif()
endif()
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
endif() endif()