Skip to content

Commit

Permalink
New snippet to fix orc
Browse files Browse the repository at this point in the history
  • Loading branch information
raulcd committed Aug 2, 2024
1 parent a36a7a4 commit ccb7ee7
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions cpp/cmake_modules/orc.diff
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
# under the License.

diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index aa520ff..01ab294 100644
index aa520ff..7bd75d1 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -464,7 +464,7 @@ add_library (orc::protoc ALIAS orc_protoc)

if (ORC_PACKAGE_KIND STREQUAL "conan")
target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES})
-elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB})
+elseif (ORC_PREFER_STATIC_PROTOBUF AND PROTOBUF_STATIC_LIB)
target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB})
@@ -416,6 +416,18 @@ endif ()
if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan")
find_package (Protobuf REQUIRED)
set(PROTOBUF_VENDORED FALSE)
+ if (Protobuf_FOUND AND NOT PROTOBUF_STATIC_LIB)
+ get_target_property (target_type protobuf::libprotobuf TYPE)
+ if (target_type STREQUAL "STATIC_LIBRARY")
+ set(PROTOBUF_STATIC_LIB protobuf::libprotobuf)
+ endif ()
+ endif()
+ if (Protobuf_FOUND AND NOT PROTOC_STATIC_LIB)
+ get_target_property (target_type protobuf::libprotoc TYPE)
+ if (target_type STREQUAL "STATIC_LIBRARY")
+ set (PROTOC_STATIC_LIB protobuf::libprotoc)
+ endif ()
+ endif()
else ()
target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY})
@@ -476,7 +476,7 @@ else ()
endif ()

if (NOT ORC_PACKAGE_KIND STREQUAL "conan")
- if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB})
+ if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB)
target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB})
else ()
target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY})
set(PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install")
set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include")

0 comments on commit ccb7ee7

Please sign in to comment.