Skip to content

Commit 50ef915

Browse files
committed
Upgrade protobuf to v22.3
Requires CMAKE_LINK_GROUP_USING of cmake 3.24.
1 parent 212a7be commit 50ef915

File tree

2 files changed

+98
-3
lines changed

2 files changed

+98
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.5)
15+
cmake_minimum_required(VERSION 3.24)
1616
project(LibProtobufMutator CXX)
1717

1818
enable_language(C)

cmake/external/protobuf.cmake

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,94 @@ ELSE()
2929
set(PROTOBUF_LIBRARIES protobuf)
3030
ENDIF()
3131

32+
# TODO: find a better way to link absl.
33+
list(APPEND PROTOBUF_LIBRARIES
34+
absl_bad_any_cast_impl
35+
absl_bad_optional_access
36+
absl_bad_variant_access
37+
absl_base
38+
absl_city
39+
absl_civil_time
40+
absl_cord
41+
absl_cord_internal
42+
absl_cordz_functions
43+
absl_cordz_handle
44+
absl_cordz_info
45+
absl_cordz_sample_token
46+
absl_crc_cord_state
47+
absl_crc_cpu_detect
48+
absl_crc_internal
49+
absl_crc32c
50+
absl_debugging_internal
51+
absl_demangle_internal
52+
absl_die_if_null
53+
absl_examine_stack
54+
absl_exponential_biased
55+
absl_failure_signal_handler
56+
absl_flags
57+
absl_flags_commandlineflag
58+
absl_flags_commandlineflag_internal
59+
absl_flags_config
60+
absl_flags_internal
61+
absl_flags_marshalling
62+
absl_flags_parse
63+
absl_flags_private_handle_accessor
64+
absl_flags_program_name
65+
absl_flags_reflection
66+
absl_flags_usage
67+
absl_flags_usage_internal
68+
absl_graphcycles_internal
69+
absl_hash
70+
absl_hashtablez_sampler
71+
absl_int128
72+
absl_leak_check
73+
absl_log_entry
74+
absl_log_flags
75+
absl_log_globals
76+
absl_log_initialize
77+
absl_log_internal_check_op
78+
absl_log_internal_conditions
79+
absl_log_internal_format
80+
absl_log_internal_globals
81+
absl_log_internal_log_sink_set
82+
absl_log_internal_message
83+
absl_log_internal_nullguard
84+
absl_log_internal_proto
85+
absl_log_severity
86+
absl_log_sink
87+
absl_low_level_hash
88+
absl_malloc_internal
89+
absl_periodic_sampler
90+
absl_random_distributions
91+
absl_random_internal_distribution_test_util
92+
absl_random_internal_platform
93+
absl_random_internal_pool_urbg
94+
absl_random_internal_randen
95+
absl_random_internal_randen_hwaes
96+
absl_random_internal_randen_hwaes_impl
97+
absl_random_internal_randen_slow
98+
absl_random_internal_seed_material
99+
absl_random_seed_gen_exception
100+
absl_random_seed_sequences
101+
absl_raw_hash_set
102+
absl_raw_logging_internal
103+
absl_scoped_set_env
104+
absl_spinlock_wait
105+
absl_stacktrace
106+
absl_status
107+
absl_statusor
108+
absl_str_format_internal
109+
absl_strerror
110+
absl_strings
111+
absl_strings_internal
112+
absl_symbolize
113+
absl_synchronization
114+
absl_throw_delegate
115+
absl_time
116+
absl_time_zone
117+
utf8_validity
118+
)
119+
32120
foreach(lib ${PROTOBUF_LIBRARIES})
33121
if (MSVC)
34122
set(LIB_PATH ${PROTOBUF_INSTALL_DIR}/lib/lib${lib}.lib)
@@ -63,7 +151,7 @@ include (ExternalProject)
63151
ExternalProject_Add(${PROTOBUF_TARGET}
64152
PREFIX ${PROTOBUF_TARGET}
65153
GIT_REPOSITORY https://github.com/google/protobuf.git
66-
GIT_TAG v21.7
154+
GIT_TAG v22.3
67155
UPDATE_COMMAND ""
68156
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${PROTOBUF_INSTALL_DIR}/src/${PROTOBUF_TARGET}/cmake
69157
-G${CMAKE_GENERATOR}
@@ -81,7 +169,14 @@ ExternalProject_Add(${PROTOBUF_TARGET}
81169
BUILD_BYPRODUCTS ${PROTOBUF_BUILD_BYPRODUCTS}
82170
)
83171

172+
# Allow to use alphabetically ordered absl lib list.
173+
set(CMAKE_LINK_GROUP_USING_cross_refs_SUPPORTED TRUE)
174+
set(CMAKE_LINK_GROUP_USING_cross_refs
175+
"LINKER:--start-group"
176+
"LINKER:--end-group"
177+
)
178+
84179
# cmake 3.7 uses Protobuf_ when 3.5 PROTOBUF_ prefixes.
85180
set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
86-
set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
181+
set(Protobuf_LIBRARIES "$<LINK_GROUP:cross_refs,${PROTOBUF_LIBRARIES}>")
87182
set(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE})

0 commit comments

Comments
 (0)