You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2023/04/13 20:45:50 UTC

[GitHub] [arrow] kou commented on a diff in pull request #35109: GH-35101: [C++] Update deprecated LOCATION target property in ArrowConfig.cmake.in

kou commented on code in PR #35109:
URL: https://github.com/apache/arrow/pull/35109#discussion_r1166008766


##########
cpp/src/arrow/ArrowConfig.cmake.in:
##########
@@ -96,11 +96,20 @@ include("${CMAKE_CURRENT_LIST_DIR}/ArrowTargets.cmake")
 
 if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies)
   add_library(Arrow::arrow_bundled_dependencies STATIC IMPORTED)
-  get_target_property(arrow_static_location Arrow::arrow_static LOCATION)
-  get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY)
+  get_target_property(arrow_static_debug_location Arrow::arrow_static
+                      IMPORTED_LOCATION_DEBUG)
+  get_filename_component(arrow_debug_lib_dir "${arrow_static_debug_location}" DIRECTORY)
   set_target_properties(Arrow::arrow_bundled_dependencies
                         PROPERTIES IMPORTED_LOCATION
-                                   "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
+                                   "${arrow_debug_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
+  )
+  get_target_property(arrow_static_release_location Arrow::arrow_static
+                      IMPORTED_LOCATION_RELEASE)
+  get_filename_component(arrow_release_lib_dir "${arrow_static_release_location}"
+                         DIRECTORY)
+  set_target_properties(Arrow::arrow_bundled_dependencies
+                        PROPERTIES IMPORTED_LOCATION_RELEASE
+                                   "${arrow_release_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"

Review Comment:
   Can we use `IMPORTED_CONFIGURATIONS` instead of explicit `DEBUG` and `RELEASE`?
   
   ```diff
   diff --git a/cpp/src/arrow/ArrowConfig.cmake.in b/cpp/src/arrow/ArrowConfig.cmake.in
   index 5bd710893b..b2097a2f31 100644
   --- a/cpp/src/arrow/ArrowConfig.cmake.in
   +++ b/cpp/src/arrow/ArrowConfig.cmake.in
   @@ -96,12 +96,16 @@ include("${CMAKE_CURRENT_LIST_DIR}/ArrowTargets.cmake")
    
    if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies)
      add_library(Arrow::arrow_bundled_dependencies STATIC IMPORTED)
   -  get_target_property(arrow_static_location Arrow::arrow_static LOCATION)
   -  get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY)
   -  set_target_properties(Arrow::arrow_bundled_dependencies
   -                        PROPERTIES IMPORTED_LOCATION
   -                                   "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
   -  )
   +  get_target_property(arrow_static_configurations Arrow::arrow_static IMPORTED_CONFIGURATIONS)
   +  foreach(CONFIGURATION ${arrow_static_configurations})
   +    string(TOUPPER "${CONFIGURATION}" CONFIGURATION)
   +    get_target_property(arrow_static_location Arrow::arrow_static LOCATION_${CONFIGURATION})
   +    get_filename_component(arrow_lib_dir "${arrow_static_location}" DIRECTORY)
   +    set_target_properties(Arrow::arrow_bundled_dependencies
   +                          PROPERTIES IMPORTED_LOCATION_${CONFIGURATION}
   +                                     "${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
   +    )
   +  endforeach()
    
      # CMP0057: Support new if() IN_LIST operator.
      # https://cmake.org/cmake/help/latest/policy/CMP0057.html
   
   ```



-- 
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-unsubscribe@arrow.apache.org

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