cmake.backbone/CPackDetectArch.cmake

21 lines
854 B
CMake
Raw Normal View History

2014-10-15 17:32:46 +04:00
# Kernel of Operation System
EXECUTE_PROCESS (COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE OSKERNEL)
MESSAGE ("OSKERNEL = ${OSKERNEL}")
STRING (TOLOWER "${OSKERNEL}" OSKERNEL)
# CPU Architecture
SET (CUSTOM_ARCHITECTURE "" CACHE STRING "Specify custom target architecutre")
SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
IF (ARCHITECTURE STREQUAL "")
# SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
# Replacements
STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
ENDIF ()
MESSAGE ("ARCHITECTURE = ${ARCHITECTURE}")