diff --git a/r/inst/build_arrow_static.sh b/r/inst/build_arrow_static.sh index 97835f15db7..73aba450ed7 100755 --- a/r/inst/build_arrow_static.sh +++ b/r/inst/build_arrow_static.sh @@ -58,7 +58,7 @@ ${CMAKE} -DARROW_BOOST_USE_SHARED=OFF \ -DARROW_COMPUTE=ON \ -DARROW_CSV=ON \ -DARROW_DATASET=ON \ - -DARROW_DEPENDENCY_SOURCE=${ARROW_DEPENDENCY_SOURCE:-AUTO} \ + -DARROW_DEPENDENCY_SOURCE=BUNDLED \ -DARROW_FILESYSTEM=ON \ -DARROW_JEMALLOC=${ARROW_JEMALLOC:-ON} \ -DARROW_JSON=ON \ diff --git a/r/tools/linuxlibs.R b/r/tools/linuxlibs.R index 760da6f92f4..1de5dc11998 100644 --- a/r/tools/linuxlibs.R +++ b/r/tools/linuxlibs.R @@ -288,8 +288,7 @@ build_libarrow <- function(src_dir, dst_dir) { ensure_cmake <- function() { cmake <- Sys.which("cmake") - # TODO: should check that cmake is of sufficient version - if (!nzchar(cmake)) { + if (!nzchar(cmake) || cmake_version() < 3.2) { # If not found, download it cat("**** cmake\n") CMAKE_VERSION <- Sys.getenv("CMAKE_VERSION", "3.16.2") @@ -312,6 +311,18 @@ ensure_cmake <- function() { cmake } +cmake_version <- function() { + tryCatch( + { + raw_version <- system("cmake --version", intern = TRUE, ignore.stderr = TRUE) + pat <- ".*?([0-9]+\\.[0-9]+\\.[0-9]+).*" + which_line <- grep(pat, raw_version) + package_version(sub(pat, "\\1", raw_version[which_line])) + }, + error = function(e) return(0) + ) +} + ##### if (!file.exists(paste0(dst_dir, "/include/arrow/api.h"))) {