diff options
author | Brad King <brad.king@kitware.com> | 2011-04-05 18:28:23 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-04-05 18:28:23 (GMT) |
commit | 3b16aa622e12f9fff46140291bb423d2b03cf90a (patch) | |
tree | f2da425464a98ac1be562080cedf495b1c5a2778 /Modules | |
parent | e252320793bd06b19366ef785734bb2d09b8ccbe (diff) | |
parent | 126c993d031f6f7be4970a67621da92f580d4e5a (diff) | |
download | CMake-3b16aa622e12f9fff46140291bb423d2b03cf90a.zip CMake-3b16aa622e12f9fff46140291bb423d2b03cf90a.tar.gz CMake-3b16aa622e12f9fff46140291bb423d2b03cf90a.tar.bz2 |
Merge topic 'linux-lib64-handling'
126c993 Fix #11964 Handle lib64 library on Linux
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/GNUInstallDirs.cmake | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index bb651de..a114dcb 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -11,7 +11,7 @@ # SYSCONFDIR - read-only single-machine data (etc) # SHAREDSTATEDIR - modifiable architecture-independent data (com) # LOCALSTATEDIR - modifiable single-machine data (var) -# LIBDIR - object code libraries (lib) +# LIBDIR - object code libraries (lib or lib64) # INCLUDEDIR - C header files (include) # OLDINCLUDEDIR - C header files for non-gcc (/usr/include) # DATAROOTDIR - read-only architecture-independent data root (share) @@ -69,7 +69,28 @@ if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR) endif() if(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "object code libraries (lib)") + set(_LIBDIR_DEFAULT "lib") + # Override this default 'lib' with 'lib64' iff: + # - we are on Linux system but NOT cross-compiling + # - we are NOT on debian + # - we are on a 64 bits system + # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # Note that the future of multi-arch handling may be even + # more complicated than that: http://wiki.debian.org/Multiarch + if(CMAKE_SYSTEM_NAME MATCHES "Linux" + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/debian_version") + if(NOT DEFINED CMAKE_SIZEOF_VOID_P) + message(AUTHOR_WARNING + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " + "Please enable at least one language before including GNUInstallDirs.") + else() + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_LIBDIR_DEFAULT "lib64") + endif() + endif() + endif() + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") endif() if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) |