From 64c38a80601a6558e38aa6f1cff1dd0ec529ab51 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 6 Oct 2023 12:22:32 +0900 Subject: [PATCH] GH-38063: [C++] Use absolute path for external project's ar/ranlib --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6d6a2bf7751ee..e2a75ffddbfa2 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -921,11 +921,15 @@ set(EP_COMMON_TOOLCHAIN "-DCMAKE_C_COMPILER=${EP_C_COMPILER}" "-DCMAKE_CXX_COMPILER=${EP_CXX_COMPILER}") if(CMAKE_AR) - list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_AR=${CMAKE_AR}) + # Ensure using absolute path. + find_program(EP_CMAKE_AR ${CMAKE_AR} REQUIRED) + list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_AR=${EP_CMAKE_AR}) endif() if(CMAKE_RANLIB) - list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_RANLIB=${CMAKE_RANLIB}) + # Ensure using absolute path. + find_program(EP_CMAKE_RANLIB ${CMAKE_RANLIB} REQUIRED) + list(APPEND EP_COMMON_TOOLCHAIN -DCMAKE_RANLIB=${EP_CMAKE_RANLIB}) endif() # External projects are still able to override the following declarations.