You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2022/11/18 04:34:48 UTC

[arrow] branch master updated: ARROW-18256: [C++][Windows] Use IMPORTED_IMPLIB for external shared Thrift (#14595)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 501b7997d4 ARROW-18256: [C++][Windows] Use IMPORTED_IMPLIB for external shared Thrift (#14595)
501b7997d4 is described below

commit 501b7997d4c4eda59f395bdc4547b5db94901903
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Fri Nov 18 13:34:41 2022 +0900

    ARROW-18256: [C++][Windows] Use IMPORTED_IMPLIB for external shared Thrift (#14595)
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 cpp/cmake_modules/FindThriftAlt.cmake | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/cpp/cmake_modules/FindThriftAlt.cmake b/cpp/cmake_modules/FindThriftAlt.cmake
index 7001e428ca..f3e49021d5 100644
--- a/cpp/cmake_modules/FindThriftAlt.cmake
+++ b/cpp/cmake_modules/FindThriftAlt.cmake
@@ -99,26 +99,24 @@ endif()
 set(ThriftAlt_LIB_NAME_BASE "thrift${THRIFT_MSVC_LIB_SUFFIX}")
 
 if(ARROW_THRIFT_USE_SHARED)
-  set(ThriftAlt_LIB_NAMES thrift)
   if(CMAKE_IMPORT_LIBRARY_SUFFIX)
-    list(APPEND
-         ThriftAlt_LIB_NAMES
-         "${CMAKE_IMPORT_LIBRARY_PREFIX}${ThriftAlt_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+    set(ThriftAlt_LIB_NAME
+        "${CMAKE_IMPORT_LIBRARY_PREFIX}${ThriftAlt_LIB_NAME_BASE}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+    )
+  else()
+    set(ThriftAlt_LIB_NAME
+        "${CMAKE_SHARED_LIBRARY_PREFIX}${ThriftAlt_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}"
     )
   endif()
-  list(APPEND
-       ThriftAlt_LIB_NAMES
-       "${CMAKE_SHARED_LIBRARY_PREFIX}${ThriftAlt_LIB_NAME_BASE}${CMAKE_SHARED_LIBRARY_SUFFIX}"
-  )
 else()
-  set(ThriftAlt_LIB_NAMES
+  set(ThriftAlt_LIB_NAME
       "${CMAKE_STATIC_LIBRARY_PREFIX}${ThriftAlt_LIB_NAME_BASE}${CMAKE_STATIC_LIBRARY_SUFFIX}"
   )
 endif()
 
 if(Thrift_ROOT)
   find_library(ThriftAlt_LIB
-               NAMES ${ThriftAlt_LIB_NAMES}
+               NAMES ${ThriftAlt_LIB_NAME}
                PATHS ${Thrift_ROOT}
                PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib")
   find_path(ThriftAlt_INCLUDE_DIR thrift/Thrift.h
@@ -139,7 +137,7 @@ else()
     list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}")
 
     find_library(ThriftAlt_LIB
-                 NAMES ${ThriftAlt_LIB_NAMES}
+                 NAMES ${ThriftAlt_LIB_NAME}
                  PATHS ${THRIFT_PC_LIBRARY_DIRS}
                  NO_DEFAULT_PATH)
     find_program(THRIFT_COMPILER thrift
@@ -149,7 +147,7 @@ else()
     set(ThriftAlt_VERSION ${THRIFT_PC_VERSION})
   else()
     find_library(ThriftAlt_LIB
-                 NAMES ${ThriftAlt_LIB_NAMES}
+                 NAMES ${ThriftAlt_LIB_NAME}
                  PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib")
     find_path(ThriftAlt_INCLUDE_DIR thrift/Thrift.h PATH_SUFFIXES "include")
     find_program(THRIFT_COMPILER thrift PATH_SUFFIXES "bin")
@@ -171,16 +169,20 @@ find_package_handle_standard_args(
 
 if(ThriftAlt_FOUND)
   set(Thrift_VERSION ${ThriftAlt_VERSION})
+  set(ThriftAlt_IMPORTED_PROPERTY_NAME IMPORTED_LOCATION)
   # Reuse partially defined thrift::thrift by ThriftConfig.cmake.
   if(NOT TARGET thrift::thrift)
     if(ARROW_THRIFT_USE_SHARED)
       add_library(thrift::thrift SHARED IMPORTED)
+      if(CMAKE_IMPORT_LIBRARY_SUFFIX)
+        set(ThriftAlt_IMPORTED_PROPERTY_NAME IMPORTED_IMPLIB)
+      endif()
     else()
       add_library(thrift::thrift STATIC IMPORTED)
     endif()
   endif()
   set_target_properties(thrift::thrift
-                        PROPERTIES IMPORTED_LOCATION "${ThriftAlt_LIB}"
+                        PROPERTIES ${ThriftAlt_IMPORTED_PROPERTY_NAME} "${ThriftAlt_LIB}"
                                    INTERFACE_INCLUDE_DIRECTORIES
                                    "${ThriftAlt_INCLUDE_DIR}")
   if(WIN32 AND NOT MSVC_TOOLCHAIN)