ENH: check return value for uname -p

This commit is contained in:
Bill Hoffman 2006-05-14 17:42:27 -04:00
parent b2c8f4d800
commit 21564b4d61
1 changed files with 9 additions and 6 deletions

View File

@ -31,16 +31,19 @@ IF(UNIX)
IF(CMAKE_UNAME) IF(CMAKE_UNAME)
EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME) EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_SYSTEM_NAME)
EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_SYSTEM_VERSION) EXEC_PROGRAM(uname ARGS -r OUTPUT_VARIABLE CMAKE_SYSTEM_VERSION)
EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) EXEC_PROGRAM(uname ARGS -p OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help") RETURN_VALUE val)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR) IF(${val} GREATER 0)
ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help") EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help") RETURN_VALUE val)
ENDIF(${val} GREATER 0)
IF(${val} GREATER 0)
SET(CMAKE_SYSTEM_PROCESSOR "unknown") SET(CMAKE_SYSTEM_PROCESSOR "unknown")
ENDIF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "--help") ENDIF(${val} GREATER 0)
SET(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command") SET(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command")
# processor may have double quote in the name, and that needs to be removed # processor may have double quote in the name, and that needs to be removed
STRING(REGEX REPLACE "\"" "" CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") STRING(REGEX REPLACE "\"" "" CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
STRING(REGEX REPLACE "/" "_" CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
ENDIF(CMAKE_UNAME) ENDIF(CMAKE_UNAME)
ELSE(UNIX) ELSE(UNIX)
IF(WIN32) IF(WIN32)