File: PlatformDefinitions.cmake

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (45 lines) | stat: -rw-r--r-- 1,910 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
# Defines a series of preprocessor variables based on the current platform.
#
# Usage: define_platform_macros(PREFIX)
#
#  where PREFIX is the macro prefix (i.e., if PREFIX is XYZZY then the macros
#  will be named XYZZY_LINUX, XYZZY_WINDOWS, etc.).
#
# Author:
#   Kevin M. Godby <kevin@godby.org>
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#

function(_define_platform_macros_impl prefix platform_string variable_name)
	if (${CMAKE_SYSTEM_NAME} MATCHES "${platform_string}")
		string(TOUPPER "${prefix}_${variable_name}" _varname)
		set(${_varname} TRUE PARENT_SCOPE)
	endif()
endfunction()

macro(define_platform_macros _prefix)
	_define_platform_macros_impl(${_prefix} "AIX" AIX)
	_define_platform_macros_impl(${_prefix} "Android" ANDROID)
	_define_platform_macros_impl(${_prefix} "BS/DOS" BSDOS)
	_define_platform_macros_impl(${_prefix} "FreeBSD" FREEBSD)
	_define_platform_macros_impl(${_prefix} "HP-UX" HPUX)
	_define_platform_macros_impl(${_prefix} "IRIX" IRIX)
	_define_platform_macros_impl(${_prefix} "Linux" LINUX)
	_define_platform_macros_impl(${_prefix} "GNU/kFreeBSD" KFREEBSD)
	_define_platform_macros_impl(${_prefix} "NetBSD" NETBSD)
	_define_platform_macros_impl(${_prefix} "OpenBSD" OPENBSD)
	_define_platform_macros_impl(${_prefix} "OFS1" OFS1)
	_define_platform_macros_impl(${_prefix} "SCO_SV" SCO_SV)
	_define_platform_macros_impl(${_prefix} "UnixWare" UNIXWARE)
	_define_platform_macros_impl(${_prefix} "Xenix" XENIX)
	_define_platform_macros_impl(${_prefix} "SunOS" SUNOS)
	_define_platform_macros_impl(${_prefix} "Tru64" TRU64)
	_define_platform_macros_impl(${_prefix} "ULTRIX" ULTRIX)
	_define_platform_macros_impl(${_prefix} "CYGWIN" CYGWIN)
	_define_platform_macros_impl(${_prefix} "Darwin" MACOSX)
	_define_platform_macros_impl(${_prefix} "Windows" WINDOWS)
endmacro()