kou commented on a change in pull request #9622:
URL: https://github.com/apache/arrow/pull/9622#discussion_r586790211
##########
File path: cpp/src/arrow/ArrowConfig.cmake.in
##########
@@ -71,19 +71,21 @@ if(NOT (TARGET arrow_shared OR TARGET arrow_static))
get_property(arrow_static_loc TARGET arrow_static PROPERTY LOCATION)
get_filename_component(arrow_lib_dir ${arrow_static_loc} DIRECTORY)
- add_library(arrow_bundled_dependencies STATIC IMPORTED)
- set_target_properties(
- arrow_bundled_dependencies
- PROPERTIES
- IMPORTED_LOCATION
-
"${arrow_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}"
- )
+ if(@ARROW_BUNDLED_STATIC_LIBS@)
Review comment:
This doesn't work when we have two or more bundled static libraries.
e.g.:
```cmake
if(jemalloc::jemalloc;mimalloc::mimalloc)
# ...
endif()
```
doesn't work:
```text
CMake Error at /tmp/local/lib/cmake/arrow/ArrowConfig.cmake:99 (if):
if given arguments:
"jemalloc::jemalloc" "mimalloc::mimalloc"
Unknown arguments specified
Call Stack (most recent call first):
/tmp/local/lib/cmake/arrow/FindArrow.cmake:213 (find_package)
/tmp/local/lib/cmake/arrow/FindArrow.cmake:320
(arrow_find_package_cmake_package_configuration)
/tmp/local/lib/cmake/arrow/FindArrow.cmake:357 (arrow_find_package)
CMakeLists.txt:24 (find_package)
```
How about using a variable?
```diff
diff --git a/cpp/src/arrow/ArrowConfig.cmake.in
b/cpp/src/arrow/ArrowConfig.cmake.in
index a5a3619eb..6209baeec 100644
--- a/cpp/src/arrow/ArrowConfig.cmake.in
+++ b/cpp/src/arrow/ArrowConfig.cmake.in
@@ -37,6 +37,7 @@ set(ARROW_FULL_SO_VERSION "@ARROW_FULL_SO_VERSION@")
set(ARROW_LIBRARY_PATH_SUFFIXES "@ARROW_LIBRARY_PATH_SUFFIXES@")
set(ARROW_INCLUDE_PATH_SUFFIXES "@ARROW_INCLUDE_PATH_SUFFIXES@")
set(ARROW_SYSTEM_DEPENDENCIES "@ARROW_SYSTEM_DEPENDENCIES@")
+set(ARROW_BUNDLED_STATIC_LIBS "@ARROW_BUNDLED_STATIC_LIBS@")
include("${CMAKE_CURRENT_LIST_DIR}/ArrowOptions.cmake")
@@ -71,7 +72,7 @@ if(NOT (TARGET arrow_shared OR TARGET arrow_static))
get_property(arrow_static_loc TARGET arrow_static PROPERTY LOCATION)
get_filename_component(arrow_lib_dir ${arrow_static_loc} DIRECTORY)
- if(@ARROW_BUNDLED_STATIC_LIBS@)
+ if(ARROW_BUNDLED_STATIC_LIBS)
add_library(arrow_bundled_dependencies STATIC IMPORTED)
set_target_properties(
arrow_bundled_dependencies
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]