My CMake modules, scripts, templates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CPackDetectArch.cmake 1.1KB

1234567891011121314151617181920212223242526
  1. # Kernel of Operation System
  2. EXECUTE_PROCESS (COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE OSKERNEL)
  3. MESSAGE ("OSKERNEL = ${OSKERNEL}")
  4. STRING (TOLOWER "${OSKERNEL}" OSKERNEL)
  5. # CPU Architecture
  6. SET (CUSTOM_ARCHITECTURE "" CACHE STRING "Specify custom target architecutre")
  7. SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
  8. IF (ARCHITECTURE STREQUAL "")
  9. # SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
  10. # SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
  11. IF (WIN32)
  12. EXECUTE_PROCESS(COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
  13. ELSE (WIN32)
  14. EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
  15. ENDIF (WIN32)
  16. # Replacements
  17. STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
  18. STRING (REGEX REPLACE "MINGW64.*" "amd64" ARCHITECTURE "${ARCHITECTURE}")
  19. STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
  20. STRING (REGEX REPLACE "MINGW32.*" "i386" ARCHITECTURE "${ARCHITECTURE}")
  21. STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
  22. ENDIF ()
  23. MESSAGE ("ARCHITECTURE = ${ARCHITECTURE}")