-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ORC-1732: [C++] Fix detecting Homebrew-installed Protobuf on MacOS #1963
Changes from 2 commits
032d9a6
18dac8c
6f29a36
4abc8d1
e6ad656
30108ae
8958559
a9326e8
7ddf8ce
d479f05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ message (STATUS "PROTOBUF_HOME: ${PROTOBUF_HOME}") | |
|
||
find_package (Protobuf CONFIG) | ||
if (Protobuf_FOUND) | ||
if (TARGET protobuf::libprotobuf) | ||
set (PROTOBUF_LIBRARY protobuf::libprotobuf) | ||
set (PROTOBUF_STATIC_LIB PROTOBUF_STATIC_LIB-NOTFOUND) | ||
set (PROTOC_LIBRARY protobuf::libprotoc) | ||
|
@@ -55,15 +56,34 @@ if (Protobuf_FOUND) | |
|
||
get_target_property (target_type protobuf::libprotobuf TYPE) | ||
if (target_type STREQUAL "STATIC_LIBRARY") | ||
set(PROTOBUF_STATIC_LIB protobuf::libprotobuf) | ||
set (PROTOBUF_STATIC_LIB protobuf::libprotobuf) | ||
endif () | ||
|
||
get_target_property (target_type protobuf::libprotoc TYPE) | ||
if (target_type STREQUAL "STATIC_LIBRARY") | ||
set (PROTOC_STATIC_LIB protobuf::libprotoc) | ||
set (PROTOC_STATIC_LIB protobuf::libprotoc) | ||
endif () | ||
|
||
get_target_property (PROTOBUF_INCLUDE_DIR protobuf::libprotoc INTERFACE_INCLUDE_DIRECTORIES) | ||
get_target_property (PROTOBUF_INCLUDE_DIR protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) | ||
if (NOT PROTOBUF_INCLUDE_DIR) | ||
set (PROTOBUF_INCLUDE_DIR ${Protobuf_INCLUDE_DIRS}) | ||
if (NOT PROTOBUF_INCLUDE_DIR) | ||
message(FATAL_ERROR "Cannot determine Protobuf include directory.") | ||
endif () | ||
endif () | ||
else () | ||
set (PROTOBUF_LIBRARY ${Protobuf_LIBRARIES}) | ||
set (PROTOBUF_INCLUDE_DIR ${Protobuf_INCLUDE_DIRS}) | ||
if (NOT PROTOBUF_INCLUDE_DIR) | ||
message(FATAL_ERROR "Cannot determine Protobuf include directory.") | ||
luffy-zh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endif () | ||
|
||
if (Protobuf_LIBRARIES MATCHES "\\.a$") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may be able to use https://cmake.org/cmake/help/latest/variable/CMAKE_STATIC_LIBRARY_SUFFIX.html instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for looking at that, '.a' has been replaced with CMAKE_STATIC_LIBRARY_SUFFIX |
||
set (PROTOBUF_STATIC_LIB ${Protobuf_LIBRARIES}) | ||
else () | ||
set (PROTOBUF_STATIC_LIB PROTOBUF_STATIC_LIB-NOTFOUND) | ||
endif () | ||
endif () | ||
|
||
else() | ||
find_path (PROTOBUF_INCLUDE_DIR google/protobuf/io/zero_copy_stream.h HINTS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about showing detection sources too for easy to debug?