summaryrefslogtreecommitdiffstats
path: root/cmake/modules/UseMultiArch.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
commitcd7b005519ade8ab6c97fcb21590b71b7d1be6e3 (patch)
treec611a8d0cd5e8f68f41b8c2d16ba580e0f40a38d /cmake/modules/UseMultiArch.cmake
parentInitial commit. (diff)
downloadlibrtr-cd7b005519ade8ab6c97fcb21590b71b7d1be6e3.tar.xz
librtr-cd7b005519ade8ab6c97fcb21590b71b7d1be6e3.zip
Adding upstream version 0.8.0.upstream/0.8.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/UseMultiArch.cmake')
-rw-r--r--cmake/modules/UseMultiArch.cmake42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmake/modules/UseMultiArch.cmake b/cmake/modules/UseMultiArch.cmake
new file mode 100644
index 0000000..06a4012
--- /dev/null
+++ b/cmake/modules/UseMultiArch.cmake
@@ -0,0 +1,42 @@
+# - Multiarch support in object code library directories
+#
+# This module sets the following variable
+# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
+# depending on the platform; use this path
+# for platform-specific binaries.
+#
+# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform;
+# use this path for architecture-independent
+# files.
+#
+# Note that it will override the results of GNUInstallDirs if included after
+# that module.
+
+# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu;
+# Fedora put module files in lib64/ too, but Debian uses lib/ for that
+if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+ # Debian or Ubuntu?
+ if (EXISTS "/etc/debian_version")
+ set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+ set (_libdir_noarch "lib")
+ else (EXISTS "/etc/debian_version")
+ # 64-bit system?
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_noarch "lib64")
+ else (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_noarch "lib")
+ endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set (_libdir_def "${_libdir_noarch}")
+ endif (EXISTS "/etc/debian_version")
+else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+ set (_libdir_def "lib")
+ set (_libdir_noarch "lib")
+endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+
+# let the user override if somewhere else is desirable
+set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
+set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files")
+mark_as_advanced (
+ CMAKE_INSTALL_LIBDIR
+ CMAKE_INSTALL_LIBDIR_NOARCH
+ )