File: UseMultiArch.cmake

package info (click to toggle)
p8-platform 2.1.0.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 504 kB
  • sloc: cpp: 5,674; ansic: 766; makefile: 5
file content (49 lines) | stat: -rw-r--r-- 1,830 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# - 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" AND
    "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
  # Debian or Ubuntu?
  if (EXISTS "/etc/debian_version")
	set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
	set (_libdir_noarch "lib")
  elseif (EXISTS "/etc/fedora-release" OR
          EXISTS "/etc/redhat-release" OR
          EXISTS "/etc/slackware-version" OR
          EXISTS "/etc/gentoo-release")
	# 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}")
  else ()
    set (_libdir_def "lib")
    set (_libdir_noarch "lib")
  endif ()
else ()
  set (_libdir_def "lib")
  set (_libdir_noarch "lib")
endif ()

# 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
  )