This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new ba5940b429 build: allow overriding the Go C compiler (#4813)
ba5940b429 is described below

commit ba5940b429507bbcb552e6ad156231078d9ab75e
Author: Efe <[email protected]>
AuthorDate: Mon Oct 5 04:07:55 2026 +0300

    build: allow overriding the Go C compiler (#4813)
    
    ## Summary
    
    Add the `ADBC_GO_CC` CMake option for selecting the C compiler used by
    cgo-backed Go library builds.
    
    Fixes #4810.
    
    AI assistance was used; the change and validation were reviewed
    manually.
    
    ---------
    
    Signed-off-by: Efe Gökdemir <[email protected]>
---
 c/cmake_modules/DefineOptions.cmake | 1 +
 c/cmake_modules/GoUtils.cmake       | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/c/cmake_modules/DefineOptions.cmake 
b/c/cmake_modules/DefineOptions.cmake
index 7a28e57c52..8c8b652f55 100644
--- a/c/cmake_modules/DefineOptions.cmake
+++ b/c/cmake_modules/DefineOptions.cmake
@@ -100,6 +100,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL 
"${CMAKE_CURRENT_SOURCE_DIR}")
                        "Compiler flags to append when compiling ADBC C++ 
libraries" "")
   define_option_string(ADBC_GO_BUILD_TAGS
                        "Build tags to append when compiling ADBC Go libraries" 
"")
+  define_option_string(ADBC_GO_CC "C compiler to use when compiling ADBC Go 
libraries" "")
 
   define_option(ADBC_BUILD_STATIC "Build static libraries" 
"${_STATIC_BUILD_DEFAULT}")
 
diff --git a/c/cmake_modules/GoUtils.cmake b/c/cmake_modules/GoUtils.cmake
index 601ba5f85d..e1354978e1 100644
--- a/c/cmake_modules/GoUtils.cmake
+++ b/c/cmake_modules/GoUtils.cmake
@@ -179,6 +179,9 @@ function(add_go_lib GO_MOD_DIR GO_LIBNAME)
   list(APPEND GO_ENV_VARS "CGO_ENABLED=1")
   list(APPEND GO_ENV_VARS "CGO_CFLAGS=${GO_FLAGS}")
   list(APPEND GO_ENV_VARS "CGO_CXXFLAGS=${GO_FLAGS}")
+  if(NOT "${ADBC_GO_CC}" STREQUAL "")
+    list(APPEND GO_ENV_VARS "CC=${ADBC_GO_CC}")
+  endif()
 
   if(BUILD_SHARED)
     set(LIB_NAME_SHARED

Reply via email to