Skip to content

Commit

Permalink
apacheGH-38063: [C++] Use absolute path for external project's ar/ran…
Browse files Browse the repository at this point in the history
…lib (apache#38064)

### Rationale for this change

If we use relative path, CMake try using relative path from a build directory.

### What changes are included in this PR?

Ensure using absolute path.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* Closes: apache#38063

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored and loicalleyne committed Nov 13, 2023
1 parent b80ca62 commit 5b95a8e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,18 @@ 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})
# RANLIB isn't used for MSVC
if(NOT MSVC)
if(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()
endif()

# External projects are still able to override the following declarations.
Expand Down

0 comments on commit 5b95a8e

Please sign in to comment.