Skip to content

Commit

Permalink
GH-44368: [C++] Use "lib" for generating bundled dependencies even wi…
Browse files Browse the repository at this point in the history
…th "clang-cl"

We can use MSVC tool such as "lib" with "clang-cl" build because it's
a MSVC like build.
  • Loading branch information
kou committed Oct 13, 2024
1 parent 6fe0ff0 commit fe3edd3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions cpp/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ function(arrow_create_merged_static_lib output_target)

set(BUNDLE_COMMAND ${LIBTOOL_MACOS} "-no_warning_for_no_symbols" "-static" "-o"
${output_lib_path} ${all_library_paths})
elseif(MSVC)
if(CMAKE_LIBTOOL)
set(BUNDLE_TOOL ${CMAKE_LIBTOOL})
else()
find_program(BUNDLE_TOOL lib HINTS "${CMAKE_CXX_COMPILER}/..")
if(NOT BUNDLE_TOOL)
message(FATAL_ERROR "Cannot locate lib.exe to bundle libraries")
endif()
endif()
set(BUNDLE_COMMAND ${BUNDLE_TOOL} /NOLOGO /OUT:${output_lib_path}
${all_library_paths})
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|GNU|Intel|IntelLLVM)$")
set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar)

Expand All @@ -140,18 +151,6 @@ function(arrow_create_merged_static_lib output_target)
endif()

set(BUNDLE_COMMAND ${ar_tool} -M < ${ar_script_path})

elseif(MSVC)
if(CMAKE_LIBTOOL)
set(BUNDLE_TOOL ${CMAKE_LIBTOOL})
else()
find_program(BUNDLE_TOOL lib HINTS "${CMAKE_CXX_COMPILER}/..")
if(NOT BUNDLE_TOOL)
message(FATAL_ERROR "Cannot locate lib.exe to bundle libraries")
endif()
endif()
set(BUNDLE_COMMAND ${BUNDLE_TOOL} /NOLOGO /OUT:${output_lib_path}
${all_library_paths})
else()
message(FATAL_ERROR "Unknown bundle scenario!")
endif()
Expand Down

0 comments on commit fe3edd3

Please sign in to comment.