This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 73273e8f00 GH-46388: [C++] Check `Snappy::snappy{,-static}` in
`FindSnappyAlt.cmake` (#46389)
73273e8f00 is described below
commit 73273e8f0026c4102a81fd7c52b5038198a5dc4a
Author: Sutou Kouhei <[email protected]>
AuthorDate: Mon May 12 14:12:29 2025 +0900
GH-46388: [C++] Check `Snappy::snappy{,-static}` in `FindSnappyAlt.cmake`
(#46389)
### Rationale for this change
Other projects' `FindSnappy.cmake` may create `Snappy::snappy{,-static}`
CMake targets. If they are created, our `FindSnappyAlt.cmake` will be failed.
### What changes are included in this PR?
Check whether `Snappy::snappy{,-static}` are already defined to avoid
conflicting with other projects' `FindSnappy.cmake`.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
Yes.
* GitHub Issue: #46388
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/cmake_modules/FindSnappyAlt.cmake | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/cpp/cmake_modules/FindSnappyAlt.cmake
b/cpp/cmake_modules/FindSnappyAlt.cmake
index 4d31340064..d0a06f0997 100644
--- a/cpp/cmake_modules/FindSnappyAlt.cmake
+++ b/cpp/cmake_modules/FindSnappyAlt.cmake
@@ -19,6 +19,18 @@ if(SnappyAlt_FOUND)
return()
endif()
+if(ARROW_SNAPPY_USE_SHARED)
+ if(TARGET Snappy::snappy)
+ set(Snappy_TARGET Snappy::snappy)
+ set(SnappyAlt_FOUND TRUE)
+ return()
+ elseif(TARGET Snappy::snappy-static)
+ set(Snappy_TARGET Snappy::snappy-static)
+ set(SnappyAlt_FOUND TRUE)
+ return()
+ endif()
+endif()
+
set(find_package_args)
if(SnappyAlt_FIND_VERSION)
list(APPEND find_package_args ${SnappyAlt_FIND_VERSION})