From 1b6fa3da6536191e6b69769c99a3994aab09cd4b Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Fri, 10 Jun 2022 16:17:21 -0700 Subject: [PATCH] [Win64] Use `CC_FOR_BUILD` when compiling GMP (#8874) This restores the use of the `CC_FOR_BUILD` environment variable. It was (accidentally) removed in 4337cdb8e2a071ded73dbc9236c8bb2f4d42e6e5 after it was added in b0500dd28ec42d6a1bada80d34b74ce8aea896cc. Without `CC_FOR_BUILD`, cross-compilation of GMP fails on Arch Linux. --- cmake/FindGMP.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake index 2e2afb898..bbbc2017b 100644 --- a/cmake/FindGMP.cmake +++ b/cmake/FindGMP.cmake @@ -91,11 +91,15 @@ if(NOT GMP_FOUND_SYSTEM) set(CONFIGURE_OPTS --host=${TOOLCHAIN_PREFIX} --build=${CMAKE_HOST_SYSTEM_PROCESSOR}) - endif() - if (CMAKE_CROSSCOMPILING_MACOS) + set(CONFIGURE_ENV ${CMAKE_COMMAND} -E - env "CFLAGS=--target=${TOOLCHAIN_PREFIX}" - env "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES}") + env "CC_FOR_BUILD=cc") + if (CMAKE_CROSSCOMPILING_MACOS) + set(CONFIGURE_ENV + ${CONFIGURE_ENV} + env "CFLAGS=--target=${TOOLCHAIN_PREFIX}" + env "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES}") + endif() endif() # `CC_FOR_BUILD`, `--host`, and `--build` are passed to `configure` to ensure -- 2.30.2