Skip to content

Commit 73273e8

Browse files
authored
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 <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent 6eb537e commit 73273e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cpp/cmake_modules/FindSnappyAlt.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ if(SnappyAlt_FOUND)
1919
return()
2020
endif()
2121

22+
if(ARROW_SNAPPY_USE_SHARED)
23+
if(TARGET Snappy::snappy)
24+
set(Snappy_TARGET Snappy::snappy)
25+
set(SnappyAlt_FOUND TRUE)
26+
return()
27+
elseif(TARGET Snappy::snappy-static)
28+
set(Snappy_TARGET Snappy::snappy-static)
29+
set(SnappyAlt_FOUND TRUE)
30+
return()
31+
endif()
32+
endif()
33+
2234
set(find_package_args)
2335
if(SnappyAlt_FIND_VERSION)
2436
list(APPEND find_package_args ${SnappyAlt_FIND_VERSION})

0 commit comments

Comments
 (0)