1macro(_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE) 2 if(NOT DEFINED HAVE_${VARIABLE}) 3 message(STATUS "Check CPU architecture is ${ARCH}") 4 set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES}) 5 configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY) 6 try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}" 7 "${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c") 8 if(HAVE_${VARIABLE}) 9 message(STATUS "Check CPU architecture is ${ARCH} - yes") 10 set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH" FORCE) 11 else () 12 message(STATUS "Check CPU architecture is ${ARCH} - no") 13 endif() 14 endif () 15endmacro(_CHECK_CPU_ARCH) 16 17macro(CHECK_CPU_ARCH_X64 VARIABLE) 18 _CHECK_CPU_ARCH(x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE}) 19endmacro(CHECK_CPU_ARCH_X64) 20 21macro(CHECK_CPU_ARCH_X86 VARIABLE) 22 _CHECK_CPU_ARCH(x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE}) 23endmacro(CHECK_CPU_ARCH_X86) 24 25macro(CHECK_CPU_ARCH_ARM64 VARIABLE) 26 _CHECK_CPU_ARCH(arm64 "defined(__aarch64__) || defined(__arm64__)" ${VARIABLE}) 27endmacro(CHECK_CPU_ARCH_ARM64) 28