build-style/cmake.sh: set CMAKE_SYSTEM_PROCESSOR on cross-builds

This commit is contained in:
maxice8 2018-10-03 03:07:08 -03:00 committed by Enno Boland
parent 1edc8846ca
commit b552a5f05d
1 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,14 @@ do_configure() {
cd ${cmake_builddir}
if [ "$CROSS_BUILD" ]; then
case "$XBPS_TARGET_MACHINE" in
x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
i686*) _CMAKE_SYSTEM_PROCESSOR=x86 ;;
aarch64*) _CMAKE_SYSTEM_PROCESSOR=aarch64 ;;
arm*) _CMAKE_SYSTEM_PROCESSOR=arm ;;
mips*) _CMAKE_SYSTEM_PROCESSOR=mips ;;
*) _CMAKE_SYSTEM_PROCESSOR=generic ;;
esac
cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
@ -15,6 +23,8 @@ SET(CMAKE_C_COMPILER ${CC})
SET(CMAKE_CXX_COMPILER ${CXX})
SET(CMAKE_CROSSCOMPILING TRUE)
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
SET(CMAKE_FIND_ROOT_PATH ${XBPS_CROSS_BASE})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)