@@ -79,6 +79,10 @@ if (APPLE)
7979 set (OPENSSL_ROOT_DIR ${OPENSSL_ROOT_DIR} /usr/local/opt/openssl/ /opt/homebrew/opt/openssl)
8080endif ()
8181find_package (OpenSSL REQUIRED )
82+ # Ensure OPENSSL_LIBRARIES is a proper CMake list (ssl and crypto as separate entries)
83+ if (OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY)
84+ set (OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} )
85+ endif ()
8286message ("OPENSSL_INCLUDE_DIR: " ${OPENSSL_INCLUDE_DIR} )
8387message ("OPENSSL_LIBRARIES: " ${OPENSSL_LIBRARIES} )
8488
@@ -89,6 +93,17 @@ if (LATEST_PROTOBUF)
8993 find_package (Protobuf REQUIRED CONFIG )
9094else ()
9195 find_package (Protobuf REQUIRED )
96+ # When lib is from thirdparty, use the same prefix for includes (avoid mixing with /usr/include)
97+ list (GET Protobuf_LIBRARIES 0 Protobuf_FIRST_LIB)
98+ if (Protobuf_FIRST_LIB AND EXISTS "${Protobuf_FIRST_LIB} " )
99+ get_filename_component (Protobuf_LIB_DIR "${Protobuf_FIRST_LIB} " DIRECTORY )
100+ get_filename_component (Protobuf_PREFIX "${Protobuf_LIB_DIR} " DIRECTORY )
101+ set (Protobuf_THIRDPARTY_INCLUDE "${Protobuf_PREFIX} /include" )
102+ if (EXISTS "${Protobuf_THIRDPARTY_INCLUDE} /google/protobuf/message.h" )
103+ set (Protobuf_INCLUDE_DIRS ${Protobuf_THIRDPARTY_INCLUDE} )
104+ message (STATUS "Using Protobuf includes from thirdparty: ${Protobuf_INCLUDE_DIRS} " )
105+ endif ()
106+ endif ()
92107endif ()
93108message ("Protobuf_INCLUDE_DIRS: " ${Protobuf_INCLUDE_DIRS} )
94109message ("Protobuf_LIBRARIES: " ${Protobuf_LIBRARIES} )
@@ -215,14 +230,35 @@ MESSAGE(STATUS "HAS_ZSTD: ${HAS_ZSTD}")
215230
216231if (LIB_SNAPPY)
217232 set (HAS_SNAPPY 1)
233+ find_path (SNAPPY_INCLUDE_DIR snappy.h )
234+ if (NOT SNAPPY_INCLUDE_DIR)
235+ message (WARNING "Snappy library found but snappy.h not found; Snappy includes may be missing" )
236+ endif ()
218237else ()
219238 set (HAS_SNAPPY 0)
239+ set (SNAPPY_INCLUDE_DIR "" )
220240endif ()
221241MESSAGE (STATUS "HAS_SNAPPY: ${HAS_SNAPPY} " )
242+ MESSAGE (STATUS "SNAPPY_INCLUDE_DIR: ${SNAPPY_INCLUDE_DIR} " )
222243
223244set (ADDITIONAL_LIBRARIES $ENV{PULSAR_ADDITIONAL_LIBRARIES} )
224245link_directories ( $ENV{PULSAR_ADDITIONAL_LIBRARY_PATH} )
225246
247+ set (TEST_INCLUDE_DIRS "" )
248+ if (BUILD_TESTS)
249+ if (GTEST_INCLUDE_PATH)
250+ list (APPEND TEST_INCLUDE_DIRS ${GTEST_INCLUDE_PATH} )
251+ endif ()
252+ if (GMOCK_INCLUDE_PATH)
253+ list (APPEND TEST_INCLUDE_DIRS ${GMOCK_INCLUDE_PATH} )
254+ endif ()
255+ endif ()
256+
257+ set (SNAPPY_INCLUDE_DIRS "" )
258+ if (HAS_SNAPPY AND SNAPPY_INCLUDE_DIR)
259+ list (APPEND SNAPPY_INCLUDE_DIRS ${SNAPPY_INCLUDE_DIR} )
260+ endif ()
261+
226262include_directories (
227263 ${PROJECT_SOURCE_DIR }
228264 ${PROJECT_SOURCE_DIR } /include
@@ -233,8 +269,8 @@ include_directories(
233269 ${ZLIB_INCLUDE_DIRS}
234270 ${CURL_INCLUDE_DIRS}
235271 ${Protobuf_INCLUDE_DIRS}
236- ${GTEST_INCLUDE_PATH }
237- ${GMOCK_INCLUDE_PATH }
272+ ${SNAPPY_INCLUDE_DIRS }
273+ ${TEST_INCLUDE_DIRS }
238274)
239275
240276set (COMMON_LIBS
0 commit comments