OpenBSD: Use 'arch -s' for host processor (#12143)

On OpenBSD 'uname -p' returns a long descriptive name for the processor.
Use 'arch -s' instead to get a short cpu name.

Suggested-by: Stuart Henderson
This commit is contained in:
Brad King 2011-05-02 10:33:18 -04:00
parent 9ea53478a6
commit 0bfabf967f
1 changed files with 5 additions and 2 deletions

View File

@ -50,14 +50,17 @@ IF(CMAKE_HOST_UNIX)
IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*")
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) RETURN_VALUE val)
ELSE(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") ELSEIF(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
EXEC_PROGRAM(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
ELSE()
EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) RETURN_VALUE val)
IF("${val}" GREATER 0) IF("${val}" GREATER 0)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val) RETURN_VALUE val)
ENDIF("${val}" GREATER 0) ENDIF("${val}" GREATER 0)
ENDIF(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*") ENDIF()
# check the return of the last uname -m or -p # check the return of the last uname -m or -p
IF("${val}" GREATER 0) IF("${val}" GREATER 0)
SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown") SET(CMAKE_HOST_SYSTEM_PROCESSOR "unknown")