1 # This module is used by the Makefile generator to determin the following variables:
2 # CMAKE_SYSTEM_NAME - on unix this is uname -s, for windows it is Windows
3 # CMAKE_SYSTEM_VERSION - on unix this is uname -r, for windows it is empty
4 # CMAKE_SYSTEM - ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}, for windows: ${CMAKE_SYSTEM}
6 # Expected uname -s output:
16 # OFS/1 (Digital Unix) OSF1
17 # SCO OpenServer 5 SCO_SV
18 # SCO UnixWare 7 UnixWare
19 # SCO UnixWare (pre release 7) UNIX_SV
25 # cygwin CYGWIN_NT-5.1
29 FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
31 EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME)
32 EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_SYSTEM_VERSION)
33 EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
34 IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help")
35 EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
36 ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help")
37 IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help")
38 SET(CMAKE_SYSTEM_PROCESSOR "unknown")
39 ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help")
40 SET(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command")
41 # processor may have double quote in the name, and that needs to be removed
42 STRING(REGEX REPLACE "\"" "" CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
46 SET (CMAKE_SYSTEM_NAME "Windows")
47 SET (CMAKE_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
51 IF(NOT CMAKE_SYSTEM_NAME)
52 SET(CMAKE_SYSTEM_NAME "UnknownOS")
53 ENDIF(NOT CMAKE_SYSTEM_NAME)
55 # fix for BSD/OS , remove the /
56 IF(CMAKE_SYSTEM_NAME MATCHES BSD.OS)
57 SET(CMAKE_SYSTEM_NAME BSDOS)
58 ENDIF(CMAKE_SYSTEM_NAME MATCHES BSD.OS)
60 # fix for CYGWIN which has windows version in it
61 IF(CMAKE_SYSTEM_NAME MATCHES CYGWIN)
62 SET(CMAKE_SYSTEM_NAME CYGWIN)
63 ENDIF(CMAKE_SYSTEM_NAME MATCHES CYGWIN)
65 # set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME
66 SET(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME})
67 # if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION}
68 IF(CMAKE_SYSTEM_VERSION)
69 SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION})
70 ENDIF(CMAKE_SYSTEM_VERSION)
73 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
74 "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
76 # configure variables set in this file for fast reload
77 CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
78 ${CMAKE_BINARY_DIR}/CMakeSystem.cmake IMMEDIATE)