From fe3edd35d1ef8b61bdefcd7b8a4f1fb92a9c3ffa Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 13 Oct 2024 13:39:10 +0900 Subject: [PATCH] GH-44368: [C++] Use "lib" for generating bundled dependencies even with "clang-cl" We can use MSVC tool such as "lib" with "clang-cl" build because it's a MSVC like build. --- cpp/cmake_modules/BuildUtils.cmake | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake index 692efa78376f4..3e0a1536c3d51 100644 --- a/cpp/cmake_modules/BuildUtils.cmake +++ b/cpp/cmake_modules/BuildUtils.cmake @@ -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) @@ -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()