diff --git a/deps/GMP/GMP.cmake b/deps/GMP/GMP.cmake index a7fe19355f..4b965ae133 100644 --- a/deps/GMP/GMP.cmake +++ b/deps/GMP/GMP.cmake @@ -36,11 +36,17 @@ else () set(_gmp_build_tgt "") # let it guess endif() + set(_cross_compile_arg "") + if (CMAKE_CROSSCOMPILING) + # TOOLCHAIN_PREFIX should be defined in the toolchain file + set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX}) + endif () + ExternalProject_Add(dep_GMP # URL https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2 URL https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 BUILD_IN_SOURCE ON - CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" ${_gmp_build_tgt} + CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" ${_gmp_build_tgt} BUILD_COMMAND make -j INSTALL_COMMAND make install ) diff --git a/deps/MPFR/MPFR.cmake b/deps/MPFR/MPFR.cmake index ddbb178d8d..a4e30e645c 100644 --- a/deps/MPFR/MPFR.cmake +++ b/deps/MPFR/MPFR.cmake @@ -18,10 +18,17 @@ if (MSVC) add_custom_target(dep_MPFR SOURCES ${_output}) else () + + set(_cross_compile_arg "") + if (CMAKE_CROSSCOMPILING) + # TOOLCHAIN_PREFIX should be defined in the toolchain file + set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX}) + endif () + ExternalProject_Add(dep_MPFR URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed BUILD_IN_SOURCE ON - CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt} + CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt} BUILD_COMMAND make -j INSTALL_COMMAND make install DEPENDS dep_GMP