kou commented on code in PR #1963:
URL: https://github.com/apache/orc/pull/1963#discussion_r1668231591
##########
cmake_modules/FindProtobuf.cmake:
##########
@@ -55,15 +64,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 from
protobuf::libprotobuf and Protobuf_INCLUDE_DIRS.")
Review Comment:
```suggestion
message (FATAL_ERROR "Cannot determine Protobuf include directory
from protobuf::libprotobuf and Protobuf_INCLUDE_DIRS.")
```
##########
cmake_modules/FindProtobuf.cmake:
##########
@@ -45,8 +45,17 @@ endif()
message (STATUS "PROTOBUF_HOME: ${PROTOBUF_HOME}")
+if (NOT DEFINED CMAKE_STATIC_LIBRARY_SUFFIX)
+ if (WIN32)
+ set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
+ else()
+ set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
+ endif()
+endif()
Review Comment:
A space before `(` may be missed:
```suggestion
set (CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
else ()
set (CMAKE_STATIC_LIBRARY_SUFFIX ".a")
endif ()
endif ()
```
BTW, do we need this fallback? I think that `CMAKE_STATIC_LIBRARY_SUFFIX` is
always defined.
##########
cmake_modules/FindProtobuf.cmake:
##########
@@ -55,15 +64,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 from
protobuf::libprotobuf and Protobuf_INCLUDE_DIRS.")
+ 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.")
Review Comment:
```suggestion
message (FATAL_ERROR "Cannot determine Protobuf include directory.")
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]