diff options
author | Brad King <brad.king@kitware.com> | 2014-01-20 14:59:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-01-20 15:55:19 (GMT) |
commit | 9d2a0900ed48eb4ae2df0e7672b9ede5af28e193 (patch) | |
tree | 624004e7c5c290671b85b3ba8897e80618daf898 /Modules/CMakeDetermineSystem.cmake | |
parent | 1b3958130e1b443368d33096764747542da28202 (diff) | |
download | CMake-9d2a0900ed48eb4ae2df0e7672b9ede5af28e193.zip CMake-9d2a0900ed48eb4ae2df0e7672b9ede5af28e193.tar.gz CMake-9d2a0900ed48eb4ae2df0e7672b9ede5af28e193.tar.bz2 |
OS X: Use 'uname -m' for processor (#14712)
In commit 2412d9bc (Use 'uname -m' for processor on Cygwin, 2010-09-21)
it was pointed out that POSIX requires 'uname -m' but not 'uname -p':
http://www.opengroup.org/onlinepubs/9699919799/utilities/uname.html
On OS X x86_64, 'uname -p' returns i386 while 'uname -m' returns x86_64.
Since the latter is the POSIX-compliant option trust its value.
However, on OS X ppc, 'uname -m' returns 'Power Macintosh' so add a
special-case to convert that to 'powerpc'.
Diffstat (limited to 'Modules/CMakeDetermineSystem.cmake')
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 7756273..f1bad99 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -47,9 +47,14 @@ if(CMAKE_HOST_UNIX) if(CMAKE_UNAME) exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) - if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin") exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) + if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND + CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh") + # OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc' + set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc") + endif() elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) |