kou commented on issue #33786:
URL: https://github.com/apache/arrow/issues/33786#issuecomment-1397817009

   We can just reuse the existing `xsimd` target:
   
   ```diff
   diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   index 3eda538fb2..b03ebbbf11 100644
   --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
   +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   @@ -2292,7 +2292,10 @@ if(ARROW_USE_XSIMD)
                         TRUE)
    
      if(xsimd_SOURCE STREQUAL "BUNDLED")
   -    add_library(xsimd INTERFACE IMPORTED)
   +    # Reuse xsimd target defined by find_package(xsimd)
   +    if(NOT TARGET xsimd)
   +      add_library(xsimd INTERFACE IMPORTED)
   +    endif()
        if(CMAKE_VERSION VERSION_LESS 3.11)
          set_target_properties(xsimd PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
                                                 "${XSIMD_INCLUDE_DIR}")
   ```
   
   Or we can use other target name like we did for ProtoBuf:
   
   ```diff
   diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
   index 8398a394e7..b193ea80d4 100644
   --- a/cpp/CMakeLists.txt
   +++ b/cpp/CMakeLists.txt
   @@ -798,8 +798,8 @@ if(ARROW_WITH_RAPIDJSON)
    endif()
    
    if(ARROW_USE_XSIMD)
   -  list(APPEND ARROW_SHARED_LINK_LIBS xsimd)
   -  list(APPEND ARROW_STATIC_LINK_LIBS xsimd)
   +  list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_XSIMD})
   +  list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_XSIMD})
    endif()
    
    add_custom_target(arrow_dependencies)
   diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   index 3eda538fb2..3480baae2d 100644
   --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
   +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
   @@ -2292,15 +2292,17 @@ if(ARROW_USE_XSIMD)
                         TRUE)
    
      if(xsimd_SOURCE STREQUAL "BUNDLED")
   -    add_library(xsimd INTERFACE IMPORTED)
   +    add_library(arrow::xsimd INTERFACE IMPORTED)
        if(CMAKE_VERSION VERSION_LESS 3.11)
   -      set_target_properties(xsimd PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
   -                                             "${XSIMD_INCLUDE_DIR}")
   +      set_target_properties(arrow::xsimd PROPERTIES 
INTERFACE_INCLUDE_DIRECTORIES
   +                                                    "${XSIMD_INCLUDE_DIR}")
        else()
   -      target_include_directories(xsimd INTERFACE "${XSIMD_INCLUDE_DIR}")
   +      target_include_directories(arrow::xsimd INTERFACE 
"${XSIMD_INCLUDE_DIR}")
        endif()
   +    set(ARROW_XSIMD arrow::xsimd)
      else()
        message(STATUS "xsimd found. Headers: ${xsimd_INCLUDE_DIRS}")
   +    set(ARROW_XSIMD xsimd)
      endif()
    endif()
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to