Skip to content

Hunter 27.1 #6

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

Open
wants to merge 3 commits into
base: hunter-27.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -2,6 +2,12 @@
# to 3.26.
cmake_minimum_required(VERSION 3.10...3.26)

include(cmake/HunterGate.cmake)
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
)

# Revert to old behavior for MSVC debug symbols.
if(POLICY CMP0141)
cmake_policy(SET CMP0141 OLD)
@@ -160,6 +166,7 @@ endif()

set(_protobuf_FIND_ZLIB)
if (protobuf_WITH_ZLIB)
hunter_add_package(ZLIB)
find_package(ZLIB)
if (ZLIB_FOUND)
set(HAVE_ZLIB 1)
@@ -286,10 +293,10 @@ include_directories(
${protobuf_BINARY_DIR}/src
${protobuf_SOURCE_DIR}/src)

set(protobuf_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")
set(protobuf_ABSL_PROVIDER "package" CACHE STRING "Provider of absl library")
set_property(CACHE protobuf_ABSL_PROVIDER PROPERTY STRINGS "module" "package")

set(protobuf_JSONCPP_PROVIDER "module" CACHE STRING "Provider of jsoncpp library")
set(protobuf_JSONCPP_PROVIDER "package" CACHE STRING "Provider of jsoncpp library")
set_property(CACHE protobuf_JSONCPP_PROVIDER PROPERTY STRINGS "module" "package")

if (protobuf_BUILD_TESTS)
539 changes: 539 additions & 0 deletions cmake/HunterGate.cmake

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cmake/abseil-cpp.cmake
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ elseif(protobuf_ABSL_PROVIDER STREQUAL "module")
endif()
elseif(protobuf_ABSL_PROVIDER STREQUAL "package")
# Use "CONFIG" as there is no built-in cmake module for absl.
hunter_add_package(abseil)
find_package(absl REQUIRED CONFIG)
endif()
set(_protobuf_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()")
1 change: 1 addition & 0 deletions cmake/conformance.cmake
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ if (protobuf_JSONCPP_PROVIDER STREQUAL "module")
" cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n")
endif()
elseif(protobuf_JSONCPP_PROVIDER STREQUAL "package")
hunter_add_package(jsoncpp)
find_package(jsoncpp REQUIRED)
endif()

3 changes: 2 additions & 1 deletion cmake/gtest.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF)
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" ON)

if (protobuf_USE_EXTERNAL_GTEST)
hunter_add_package(GTest)
find_package(GTest REQUIRED CONFIG)
else()
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
11 changes: 8 additions & 3 deletions cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
@@ -16,12 +16,12 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
set_target_properties(libprotobuf-lite PROPERTIES
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
endif()
target_link_libraries(libprotobuf-lite PRIVATE ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libprotobuf-lite PUBLIC ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf-lite PRIVATE atomic)
target_link_libraries(libprotobuf-lite PUBLIC atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf-lite PRIVATE log)
target_link_libraries(libprotobuf-lite PUBLIC log)
endif()
target_include_directories(libprotobuf-lite PUBLIC
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
@@ -46,3 +46,8 @@ set_target_properties(libprotobuf-lite PROPERTIES
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)

target_link_libraries(libprotobuf-lite PRIVATE utf8_validity)

if(ANDROID)
find_package(android_log REQUIRED)
target_link_libraries(libprotobuf-lite PUBLIC android_log::android_log)
endif()
13 changes: 9 additions & 4 deletions cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
@@ -16,15 +16,15 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
set_target_properties(libprotobuf PROPERTIES
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotobuf.map)
endif()
target_link_libraries(libprotobuf PRIVATE ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libprotobuf PUBLIC ${CMAKE_THREAD_LIBS_INIT})
if(protobuf_WITH_ZLIB)
target_link_libraries(libprotobuf PRIVATE ${ZLIB_LIBRARIES})
target_link_libraries(libprotobuf PUBLIC ${ZLIB_LIBRARIES})
endif()
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf PRIVATE atomic)
target_link_libraries(libprotobuf PUBLIC atomic)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf PRIVATE log)
target_link_libraries(libprotobuf PUBLIC log)
endif()
target_include_directories(libprotobuf PUBLIC
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
@@ -49,3 +49,8 @@ set_target_properties(libprotobuf PROPERTIES
add_library(protobuf::libprotobuf ALIAS libprotobuf)

target_link_libraries(libprotobuf PRIVATE utf8_validity)

if(ANDROID)
find_package(android_log REQUIRED)
target_link_libraries(libprotobuf PUBLIC android_log::android_log)
endif()
4 changes: 4 additions & 0 deletions cmake/protobuf-config.cmake.in
Original file line number Diff line number Diff line change
@@ -16,3 +16,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-generate.cmake")
if(protobuf_MODULE_COMPATIBLE)
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
endif()

if(ANDROID)
find_package(android_log REQUIRED)
endif()
8 changes: 8 additions & 0 deletions cmake/protobuf-module.cmake.in
Original file line number Diff line number Diff line change
@@ -126,9 +126,17 @@ _protobuf_find_libraries(Protobuf protobuf)
# The Protobuf Lite library
_protobuf_find_libraries(Protobuf_LITE protobuf-lite)

if(@protobuf_BUILD_PROTOC_BINARIES@)

# The Protobuf Protoc Library
_protobuf_find_libraries(Protobuf_PROTOC protoc)

endif()

if(UNIX)
_protobuf_find_threads()
endif()

# Set the include directory
get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf
INTERFACE_INCLUDE_DIRECTORIES)