Skip to content

Commit cc888c4

Browse files
committed
libsql-ffi: Fix cross compilation with cmake crate
If user specifies the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER environment variables, let's use them instead of defaulting to clang all the time.
1 parent fc98e19 commit cc888c4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libsql-ffi/build.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,18 @@ fn build_multiple_ciphers(out_path: &Path) -> PathBuf {
470470
.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON")
471471
.profile("Release");
472472

473+
if let Ok(cc) = env::var("CMAKE_C_COMPILER") {
474+
let mut build = cc::Build::new();
475+
build.compiler(cc);
476+
config.init_c_cfg(build);
477+
}
478+
479+
if let Ok(cxx) = env::var("CMAKE_CXX_COMPILER") {
480+
let mut build = cc::Build::new();
481+
build.compiler(cxx);
482+
config.init_cxx_cfg(build);
483+
}
484+
473485
if cfg!(feature = "wasmtime-bindings") {
474486
config.define("LIBSQL_ENABLE_WASM_RUNTIME", "1");
475487
}

0 commit comments

Comments
 (0)