Remove --build from GMP configure line (#8752)
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>
Wed, 11 May 2022 18:13:31 +0000 (11:13 -0700)
committerGitHub <noreply@github.com>
Wed, 11 May 2022 18:13:31 +0000 (11:13 -0700)
This is an attempt to fix the pypi build.

cmake/FindGMP.cmake

index 38771692a0f1e148ceb27fe840e2c52f4c5b1fee..481bd973a176d6eb76c9c04a16234eab6e0d9d00 100644 (file)
@@ -65,6 +65,11 @@ if(NOT GMP_FOUND_SYSTEM)
     set(GMP_LIBRARIES "${DEPS_BASE}/lib/libgmp.a")
   endif()
 
+  set(CONFIGURE_OPTS "")
+  if(CMAKE_CROSSCOMPILING)
+    set(CONFIGURE_OPTS --host=${TOOLCHAIN_PREFIX} --build=${CMAKE_HOST_SYSTEM_PROCESSOR})
+  endif()
+
   # `CC_FOR_BUILD`, `--host`, and `--build` are passed to `configure` to ensure
   # that cross-compilation works (as suggested in the GMP documentation).
   # Without the `--build` flag, `configure` may fail for cross-compilation
@@ -81,8 +86,7 @@ if(NOT GMP_FOUND_SYSTEM)
           --prefix=<INSTALL_DIR>
           --with-pic
           --enable-cxx
-          --host=${TOOLCHAIN_PREFIX}
-          --build=${CMAKE_HOST_SYSTEM_PROCESSOR}
+          ${CONFIGURE_OPTS}
     BUILD_BYPRODUCTS ${GMP_LIBRARIES}
   )
 endif()