-
Notifications
You must be signed in to change notification settings - Fork 25
/
GetPlatform.cmake
34 lines (27 loc) · 937 Bytes
/
GetPlatform.cmake
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
# Create defines based on platform
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(TARGET_PLATFORM_WINDOWS 1)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(TARGET_PLATFORM_LINUX 1)
elseif (CMAKE_SYSTEM_NAME MATCHES "Xbone")
set(TARGET_PLATFORM_XBONE 1)
endif ()
# Determine target architecture
if ((CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TARGET_ARCH_X64 1)
set(TARGET_ARCH_NAME "x86-64")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET_ARCH_X86 1)
set(TARGET_ARCH_NAME "x86")
endif()
# Determine compiler
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(TARGET_COMPILER_MSVC 1)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(TARGET_COMPILER_CLANG 1)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(TARGET_COMPILER_GCC 1)
endif()
# Check if compiler is good enough
if (TARGET_COMPILER_MSVC)
endif()