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.