xref: /aosp_15_r20/external/cronet/third_party/abseil-cpp/CMake/AbseilDll.cmake (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1include(CMakeParseArguments)
2include(GNUInstallDirs)
3
4set(ABSL_INTERNAL_DLL_FILES
5  "algorithm/algorithm.h"
6  "algorithm/container.h"
7  "base/attributes.h"
8  "base/call_once.h"
9  "base/casts.h"
10  "base/config.h"
11  "base/const_init.h"
12  "base/dynamic_annotations.h"
13  "base/internal/atomic_hook.h"
14  "base/internal/cycleclock.cc"
15  "base/internal/cycleclock.h"
16  "base/internal/cycleclock_config.h"
17  "base/internal/direct_mmap.h"
18  "base/internal/endian.h"
19  "base/internal/errno_saver.h"
20  "base/internal/fast_type_id.h"
21  "base/internal/hide_ptr.h"
22  "base/internal/identity.h"
23  "base/internal/invoke.h"
24  "base/internal/inline_variable.h"
25  "base/internal/low_level_alloc.cc"
26  "base/internal/low_level_alloc.h"
27  "base/internal/low_level_scheduling.h"
28  "base/internal/nullability_impl.h"
29  "base/internal/per_thread_tls.h"
30  "base/prefetch.h"
31  "base/internal/pretty_function.h"
32  "base/internal/raw_logging.cc"
33  "base/internal/raw_logging.h"
34  "base/internal/scheduling_mode.h"
35  "base/internal/scoped_set_env.cc"
36  "base/internal/scoped_set_env.h"
37  "base/internal/strerror.h"
38  "base/internal/strerror.cc"
39  "base/internal/spinlock.cc"
40  "base/internal/spinlock.h"
41  "base/internal/spinlock_wait.cc"
42  "base/internal/spinlock_wait.h"
43  "base/internal/sysinfo.cc"
44  "base/internal/sysinfo.h"
45  "base/internal/thread_identity.cc"
46  "base/internal/thread_identity.h"
47  "base/internal/throw_delegate.cc"
48  "base/internal/throw_delegate.h"
49  "base/internal/tsan_mutex_interface.h"
50  "base/internal/unaligned_access.h"
51  "base/internal/unscaledcycleclock.cc"
52  "base/internal/unscaledcycleclock.h"
53  "base/internal/unscaledcycleclock_config.h"
54  "base/log_severity.cc"
55  "base/log_severity.h"
56  "base/macros.h"
57  "base/no_destructor.h"
58  "base/nullability.h"
59  "base/optimization.h"
60  "base/options.h"
61  "base/policy_checks.h"
62  "base/port.h"
63  "base/thread_annotations.h"
64  "cleanup/cleanup.h"
65  "cleanup/internal/cleanup.h"
66  "container/btree_map.h"
67  "container/btree_set.h"
68  "container/fixed_array.h"
69  "container/flat_hash_map.h"
70  "container/flat_hash_set.h"
71  "container/inlined_vector.h"
72  "container/internal/btree.h"
73  "container/internal/btree_container.h"
74  "container/internal/common.h"
75  "container/internal/common_policy_traits.h"
76  "container/internal/compressed_tuple.h"
77  "container/internal/container_memory.h"
78  "container/internal/hash_function_defaults.h"
79  "container/internal/hash_policy_traits.h"
80  "container/internal/hashtable_debug.h"
81  "container/internal/hashtable_debug_hooks.h"
82  "container/internal/hashtablez_sampler.cc"
83  "container/internal/hashtablez_sampler.h"
84  "container/internal/hashtablez_sampler_force_weak_definition.cc"
85  "container/internal/inlined_vector.h"
86  "container/internal/layout.h"
87  "container/internal/node_slot_policy.h"
88  "container/internal/raw_hash_map.h"
89  "container/internal/raw_hash_set.cc"
90  "container/internal/raw_hash_set.h"
91  "container/internal/tracked.h"
92  "container/node_hash_map.h"
93  "container/node_hash_set.h"
94  "crc/crc32c.cc"
95  "crc/crc32c.h"
96  "crc/internal/cpu_detect.cc"
97  "crc/internal/cpu_detect.h"
98  "crc/internal/crc32c.h"
99  "crc/internal/crc32c_inline.h"
100  "crc/internal/crc32_x86_arm_combined_simd.h"
101  "crc/internal/crc.cc"
102  "crc/internal/crc.h"
103  "crc/internal/crc_cord_state.cc"
104  "crc/internal/crc_cord_state.h"
105  "crc/internal/crc_internal.h"
106  "crc/internal/crc_x86_arm_combined.cc"
107  "crc/internal/crc_memcpy_fallback.cc"
108  "crc/internal/crc_memcpy.h"
109  "crc/internal/crc_memcpy_x86_arm_combined.cc"
110  "crc/internal/crc_non_temporal_memcpy.cc"
111  "crc/internal/crc_x86_arm_combined.cc"
112  "crc/internal/non_temporal_arm_intrinsics.h"
113  "crc/internal/non_temporal_memcpy.h"
114  "debugging/failure_signal_handler.cc"
115  "debugging/failure_signal_handler.h"
116  "debugging/leak_check.h"
117  "debugging/stacktrace.cc"
118  "debugging/stacktrace.h"
119  "debugging/symbolize.cc"
120  "debugging/symbolize.h"
121  "debugging/internal/address_is_readable.cc"
122  "debugging/internal/address_is_readable.h"
123  "debugging/internal/demangle.cc"
124  "debugging/internal/demangle.h"
125  "debugging/internal/elf_mem_image.cc"
126  "debugging/internal/elf_mem_image.h"
127  "debugging/internal/examine_stack.cc"
128  "debugging/internal/examine_stack.h"
129  "debugging/internal/stack_consumption.cc"
130  "debugging/internal/stack_consumption.h"
131  "debugging/internal/stacktrace_config.h"
132  "debugging/internal/symbolize.h"
133  "debugging/internal/vdso_support.cc"
134  "debugging/internal/vdso_support.h"
135  "functional/any_invocable.h"
136  "functional/internal/front_binder.h"
137  "functional/bind_front.h"
138  "functional/function_ref.h"
139  "functional/internal/any_invocable.h"
140  "functional/internal/function_ref.h"
141  "functional/overload.h"
142  "hash/hash.h"
143  "hash/internal/city.h"
144  "hash/internal/city.cc"
145  "hash/internal/hash.h"
146  "hash/internal/hash.cc"
147  "hash/internal/spy_hash_state.h"
148  "hash/internal/low_level_hash.h"
149  "hash/internal/low_level_hash.cc"
150  "log/absl_check.h"
151  "log/absl_log.h"
152  "log/absl_vlog_is_on.h"
153  "log/check.h"
154  "log/die_if_null.cc"
155  "log/die_if_null.h"
156  "log/globals.cc"
157  "log/globals.h"
158  "log/internal/append_truncated.h"
159  "log/internal/check_impl.h"
160  "log/internal/check_op.cc"
161  "log/internal/check_op.h"
162  "log/internal/conditions.cc"
163  "log/internal/conditions.h"
164  "log/internal/config.h"
165  "log/internal/fnmatch.h"
166  "log/internal/fnmatch.cc"
167  "log/internal/globals.cc"
168  "log/internal/globals.h"
169  "log/internal/log_format.cc"
170  "log/internal/log_format.h"
171  "log/internal/log_impl.h"
172  "log/internal/log_message.cc"
173  "log/internal/log_message.h"
174  "log/internal/log_sink_set.cc"
175  "log/internal/log_sink_set.h"
176  "log/internal/nullguard.cc"
177  "log/internal/nullguard.h"
178  "log/internal/nullstream.h"
179  "log/internal/proto.h"
180  "log/internal/proto.cc"
181  "log/internal/strip.h"
182  "log/internal/structured.h"
183  "log/internal/vlog_config.cc"
184  "log/internal/vlog_config.h"
185  "log/internal/voidify.h"
186  "log/initialize.cc"
187  "log/initialize.h"
188  "log/log.h"
189  "log/log_entry.cc"
190  "log/log_entry.h"
191  "log/log_sink.cc"
192  "log/log_sink.h"
193  "log/log_sink_registry.h"
194  "log/log_streamer.h"
195  "log/structured.h"
196  "log/vlog_is_on.h"
197  "memory/memory.h"
198  "meta/type_traits.h"
199  "numeric/bits.h"
200  "numeric/int128.cc"
201  "numeric/int128.h"
202  "numeric/internal/bits.h"
203  "numeric/internal/representation.h"
204  "profiling/internal/exponential_biased.cc"
205  "profiling/internal/exponential_biased.h"
206  "profiling/internal/periodic_sampler.cc"
207  "profiling/internal/periodic_sampler.h"
208  "profiling/internal/sample_recorder.h"
209  "random/bernoulli_distribution.h"
210  "random/beta_distribution.h"
211  "random/bit_gen_ref.h"
212  "random/discrete_distribution.cc"
213  "random/discrete_distribution.h"
214  "random/distributions.h"
215  "random/exponential_distribution.h"
216  "random/gaussian_distribution.cc"
217  "random/gaussian_distribution.h"
218  "random/internal/distribution_caller.h"
219  "random/internal/fastmath.h"
220  "random/internal/fast_uniform_bits.h"
221  "random/internal/generate_real.h"
222  "random/internal/iostream_state_saver.h"
223  "random/internal/nonsecure_base.h"
224  "random/internal/pcg_engine.h"
225  "random/internal/platform.h"
226  "random/internal/pool_urbg.cc"
227  "random/internal/pool_urbg.h"
228  "random/internal/randen.cc"
229  "random/internal/randen.h"
230  "random/internal/randen_detect.cc"
231  "random/internal/randen_detect.h"
232  "random/internal/randen_engine.h"
233  "random/internal/randen_hwaes.cc"
234  "random/internal/randen_hwaes.h"
235  "random/internal/randen_round_keys.cc"
236  "random/internal/randen_slow.cc"
237  "random/internal/randen_slow.h"
238  "random/internal/randen_traits.h"
239  "random/internal/salted_seed_seq.h"
240  "random/internal/seed_material.cc"
241  "random/internal/seed_material.h"
242  "random/internal/sequence_urbg.h"
243  "random/internal/traits.h"
244  "random/internal/uniform_helper.h"
245  "random/internal/wide_multiply.h"
246  "random/log_uniform_int_distribution.h"
247  "random/poisson_distribution.h"
248  "random/random.h"
249  "random/seed_gen_exception.cc"
250  "random/seed_gen_exception.h"
251  "random/seed_sequences.cc"
252  "random/seed_sequences.h"
253  "random/uniform_int_distribution.h"
254  "random/uniform_real_distribution.h"
255  "random/zipf_distribution.h"
256  "status/internal/status_internal.h"
257  "status/internal/status_internal.cc"
258  "status/internal/statusor_internal.h"
259  "status/status.h"
260  "status/status.cc"
261  "status/statusor.h"
262  "status/statusor.cc"
263  "status/status_payload_printer.h"
264  "status/status_payload_printer.cc"
265  "strings/ascii.cc"
266  "strings/ascii.h"
267  "strings/charconv.cc"
268  "strings/charconv.h"
269  "strings/charset.h"
270  "strings/cord.cc"
271  "strings/cord.h"
272  "strings/cord_analysis.cc"
273  "strings/cord_analysis.h"
274  "strings/cord_buffer.cc"
275  "strings/cord_buffer.h"
276  "strings/escaping.cc"
277  "strings/escaping.h"
278  "strings/internal/charconv_bigint.cc"
279  "strings/internal/charconv_bigint.h"
280  "strings/internal/charconv_parse.cc"
281  "strings/internal/charconv_parse.h"
282  "strings/internal/cord_data_edge.h"
283  "strings/internal/cord_internal.cc"
284  "strings/internal/cord_internal.h"
285  "strings/internal/cord_rep_btree.cc"
286  "strings/internal/cord_rep_btree.h"
287  "strings/internal/cord_rep_btree_navigator.cc"
288  "strings/internal/cord_rep_btree_navigator.h"
289  "strings/internal/cord_rep_btree_reader.cc"
290  "strings/internal/cord_rep_btree_reader.h"
291  "strings/internal/cord_rep_crc.cc"
292  "strings/internal/cord_rep_crc.h"
293  "strings/internal/cord_rep_consume.h"
294  "strings/internal/cord_rep_consume.cc"
295  "strings/internal/cord_rep_flat.h"
296  "strings/internal/cordz_functions.cc"
297  "strings/internal/cordz_functions.h"
298  "strings/internal/cordz_handle.cc"
299  "strings/internal/cordz_handle.h"
300  "strings/internal/cordz_info.cc"
301  "strings/internal/cordz_info.h"
302  "strings/internal/cordz_sample_token.cc"
303  "strings/internal/cordz_sample_token.h"
304  "strings/internal/cordz_statistics.h"
305  "strings/internal/cordz_update_scope.h"
306  "strings/internal/cordz_update_tracker.h"
307  "strings/internal/damerau_levenshtein_distance.h"
308  "strings/internal/damerau_levenshtein_distance.cc"
309  "strings/internal/stl_type_traits.h"
310  "strings/internal/string_constant.h"
311  "strings/internal/stringify_sink.h"
312  "strings/internal/stringify_sink.cc"
313  "strings/internal/has_absl_stringify.h"
314  "strings/has_absl_stringify.h"
315  "strings/has_ostream_operator.h"
316  "strings/match.cc"
317  "strings/match.h"
318  "strings/numbers.cc"
319  "strings/numbers.h"
320  "strings/str_format.h"
321  "strings/str_cat.cc"
322  "strings/str_cat.h"
323  "strings/str_join.h"
324  "strings/str_replace.cc"
325  "strings/str_replace.h"
326  "strings/str_split.cc"
327  "strings/str_split.h"
328  "strings/string_view.cc"
329  "strings/string_view.h"
330  "strings/strip.h"
331  "strings/substitute.cc"
332  "strings/substitute.h"
333  "strings/internal/escaping.h"
334  "strings/internal/escaping.cc"
335  "strings/internal/memutil.cc"
336  "strings/internal/memutil.h"
337  "strings/internal/ostringstream.cc"
338  "strings/internal/ostringstream.h"
339  "strings/internal/pow10_helper.cc"
340  "strings/internal/pow10_helper.h"
341  "strings/internal/resize_uninitialized.h"
342  "strings/internal/str_format/arg.cc"
343  "strings/internal/str_format/arg.h"
344  "strings/internal/str_format/bind.cc"
345  "strings/internal/str_format/bind.h"
346  "strings/internal/str_format/checker.h"
347  "strings/internal/str_format/constexpr_parser.h"
348  "strings/internal/str_format/extension.cc"
349  "strings/internal/str_format/extension.h"
350  "strings/internal/str_format/float_conversion.cc"
351  "strings/internal/str_format/float_conversion.h"
352  "strings/internal/str_format/output.cc"
353  "strings/internal/str_format/output.h"
354  "strings/internal/str_format/parser.cc"
355  "strings/internal/str_format/parser.h"
356  "strings/internal/str_join_internal.h"
357  "strings/internal/str_split_internal.h"
358  "strings/internal/utf8.cc"
359  "strings/internal/utf8.h"
360  "synchronization/barrier.cc"
361  "synchronization/barrier.h"
362  "synchronization/blocking_counter.cc"
363  "synchronization/blocking_counter.h"
364  "synchronization/mutex.cc"
365  "synchronization/mutex.h"
366  "synchronization/notification.cc"
367  "synchronization/notification.h"
368  "synchronization/internal/create_thread_identity.cc"
369  "synchronization/internal/create_thread_identity.h"
370  "synchronization/internal/futex.h"
371  "synchronization/internal/futex_waiter.h"
372  "synchronization/internal/futex_waiter.cc"
373  "synchronization/internal/graphcycles.cc"
374  "synchronization/internal/graphcycles.h"
375  "synchronization/internal/kernel_timeout.h"
376  "synchronization/internal/kernel_timeout.cc"
377  "synchronization/internal/per_thread_sem.cc"
378  "synchronization/internal/per_thread_sem.h"
379  "synchronization/internal/pthread_waiter.h"
380  "synchronization/internal/pthread_waiter.cc"
381  "synchronization/internal/sem_waiter.h"
382  "synchronization/internal/sem_waiter.cc"
383  "synchronization/internal/stdcpp_waiter.h"
384  "synchronization/internal/stdcpp_waiter.cc"
385  "synchronization/internal/thread_pool.h"
386  "synchronization/internal/waiter.h"
387  "synchronization/internal/waiter_base.h"
388  "synchronization/internal/waiter_base.cc"
389  "synchronization/internal/win32_waiter.h"
390  "synchronization/internal/win32_waiter.cc"
391  "time/civil_time.cc"
392  "time/civil_time.h"
393  "time/clock.cc"
394  "time/clock.h"
395  "time/duration.cc"
396  "time/format.cc"
397  "time/time.cc"
398  "time/time.h"
399  "time/internal/cctz/include/cctz/civil_time.h"
400  "time/internal/cctz/include/cctz/civil_time_detail.h"
401  "time/internal/cctz/include/cctz/time_zone.h"
402  "time/internal/cctz/include/cctz/zone_info_source.h"
403  "time/internal/cctz/src/civil_time_detail.cc"
404  "time/internal/cctz/src/time_zone_fixed.cc"
405  "time/internal/cctz/src/time_zone_fixed.h"
406  "time/internal/cctz/src/time_zone_format.cc"
407  "time/internal/cctz/src/time_zone_if.cc"
408  "time/internal/cctz/src/time_zone_if.h"
409  "time/internal/cctz/src/time_zone_impl.cc"
410  "time/internal/cctz/src/time_zone_impl.h"
411  "time/internal/cctz/src/time_zone_info.cc"
412  "time/internal/cctz/src/time_zone_info.h"
413  "time/internal/cctz/src/time_zone_libc.cc"
414  "time/internal/cctz/src/time_zone_libc.h"
415  "time/internal/cctz/src/time_zone_lookup.cc"
416  "time/internal/cctz/src/time_zone_posix.cc"
417  "time/internal/cctz/src/time_zone_posix.h"
418  "time/internal/cctz/src/tzfile.h"
419  "time/internal/cctz/src/zone_info_source.cc"
420  "types/any.h"
421  "types/bad_any_cast.cc"
422  "types/bad_any_cast.h"
423  "types/bad_optional_access.cc"
424  "types/bad_optional_access.h"
425  "types/bad_variant_access.cc"
426  "types/bad_variant_access.h"
427  "types/compare.h"
428  "types/internal/variant.h"
429  "types/optional.h"
430  "types/internal/optional.h"
431  "types/span.h"
432  "types/internal/span.h"
433  "types/variant.h"
434  "utility/internal/if_constexpr.h"
435  "utility/utility.h"
436  "debugging/leak_check.cc"
437)
438
439set(ABSL_INTERNAL_DLL_TARGETS
440  "absl_check"
441  "absl_log"
442  "algorithm"
443  "algorithm_container"
444  "any"
445  "any_invocable"
446  "atomic_hook"
447  "bad_any_cast"
448  "bad_any_cast_impl"
449  "bad_optional_access"
450  "bad_variant_access"
451  "base"
452  "base_internal"
453  "bind_front"
454  "bits"
455  "btree"
456  "check"
457  "city"
458  "civil_time"
459  "compare"
460  "compressed_tuple"
461  "config"
462  "container"
463  "container_common"
464  "container_memory"
465  "cord"
466  "cord_internal"
467  "cordz_functions"
468  "cordz_handle"
469  "cordz_info"
470  "cordz_sample_token"
471  "core_headers"
472  "counting_allocator"
473  "crc_cord_state"
474  "crc_cpu_detect"
475  "crc_internal"
476  "crc32c"
477  "debugging"
478  "debugging_internal"
479  "demangle_internal"
480  "die_if_null"
481  "dynamic_annotations"
482  "endian"
483  "examine_stack"
484  "exponential_biased"
485  "failure_signal_handler"
486  "fixed_array"
487  "flat_hash_map"
488  "flat_hash_set"
489  "function_ref"
490  "graphcycles_internal"
491  "hash"
492  "hash_function_defaults"
493  "hash_policy_traits"
494  "hashtable_debug"
495  "hashtable_debug_hooks"
496  "hashtablez_sampler"
497  "inlined_vector"
498  "inlined_vector_internal"
499  "int128"
500  "kernel_timeout_internal"
501  "layout"
502  "leak_check"
503  "log_internal_check_impl"
504  "log_internal_check_op"
505  "log_internal_conditions"
506  "log_internal_config"
507  "log_internal_format"
508  "log_internal_globals"
509  "log_internal_log_impl"
510  "log_internal_proto"
511  "log_internal_message"
512  "log_internal_log_sink_set"
513  "log_internal_nullguard"
514  "log_internal_nullstream"
515  "log_internal_strip"
516  "log_internal_voidify"
517  "log_internal_append_truncated"
518  "log_globals"
519  "log_initialize"
520  "log"
521  "log_entry"
522  "log_sink"
523  "log_sink_registry"
524  "log_streamer"
525  "log_internal_structured"
526  "log_severity"
527  "log_structured"
528  "low_level_hash"
529  "malloc_internal"
530  "memory"
531  "meta"
532  "node_hash_map"
533  "node_hash_set"
534  "node_slot_policy"
535  "non_temporal_arm_intrinsics"
536  "non_temporal_memcpy"
537  "numeric"
538  "optional"
539  "periodic_sampler"
540  "pow10_helper"
541  "pretty_function"
542  "random_bit_gen_ref"
543  "random_distributions"
544  "random_internal_distribution_caller"
545  "random_internal_distributions"
546  "random_internal_explicit_seed_seq"
547  "random_internal_fastmath"
548  "random_internal_fast_uniform_bits"
549  "random_internal_generate_real"
550  "random_internal_iostream_state_saver"
551  "random_internal_nonsecure_base"
552  "random_internal_pcg_engine"
553  "random_internal_platform"
554  "random_internal_pool_urbg"
555  "random_internal_randen"
556  "random_internal_randen_engine"
557  "random_internal_randen_hwaes"
558  "random_internal_randen_hwaes_impl"
559  "random_internal_randen_slow"
560  "random_internal_salted_seed_seq"
561  "random_internal_seed_material"
562  "random_internal_sequence_urbg"
563  "random_internal_traits"
564  "random_internal_uniform_helper"
565  "random_internal_wide_multiply"
566  "random_random"
567  "random_seed_gen_exception"
568  "random_seed_sequences"
569  "raw_hash_map"
570  "raw_hash_set"
571  "raw_logging_internal"
572  "sample_recorder"
573  "scoped_set_env"
574  "span"
575  "spinlock_wait"
576  "spy_hash_state"
577  "stack_consumption"
578  "stacktrace"
579  "status"
580  "statusor"
581  "str_format"
582  "str_format_internal"
583  "strerror"
584  "strings"
585  "strings_internal"
586  "symbolize"
587  "synchronization"
588  "thread_pool"
589  "throw_delegate"
590  "time"
591  "time_zone"
592  "tracked"
593  "type_traits"
594  "utility"
595  "variant"
596)
597
598set(ABSL_INTERNAL_TEST_DLL_FILES
599  "hash/hash_testing.h"
600  "log/scoped_mock_log.cc"
601  "log/scoped_mock_log.h"
602  "random/internal/chi_square.cc"
603  "random/internal/chi_square.h"
604  "random/internal/distribution_test_util.cc"
605  "random/internal/distribution_test_util.h"
606  "random/internal/mock_helpers.h"
607  "random/internal/mock_overload_set.h"
608  "random/mocking_bit_gen.h"
609  "random/mock_distributions.h"
610  "strings/cordz_test_helpers.h"
611  "strings/cord_test_helpers.h"
612)
613
614set(ABSL_INTERNAL_TEST_DLL_TARGETS
615  "cord_test_helpers"
616  "cordz_test_helpers"
617  "hash_testing"
618  "random_mocking_bit_gen"
619  "random_internal_distribution_test_util"
620  "random_internal_mock_overload_set"
621  "scoped_mock_log"
622)
623
624include(CheckCXXSourceCompiles)
625
626check_cxx_source_compiles(
627  [==[
628#ifdef _MSC_VER
629#  if _MSVC_LANG < 201703L
630#    error "The compiler defaults or is configured for C++ < 17"
631#  endif
632#elif __cplusplus < 201703L
633#  error "The compiler defaults or is configured for C++ < 17"
634#endif
635int main() { return 0; }
636]==]
637  ABSL_INTERNAL_AT_LEAST_CXX17)
638
639check_cxx_source_compiles(
640  [==[
641#ifdef _MSC_VER
642#  if _MSVC_LANG < 202002L
643#    error "The compiler defaults or is configured for C++ < 20"
644#  endif
645#elif __cplusplus < 202002L
646#  error "The compiler defaults or is configured for C++ < 20"
647#endif
648int main() { return 0; }
649]==]
650  ABSL_INTERNAL_AT_LEAST_CXX20)
651
652if(ABSL_INTERNAL_AT_LEAST_CXX20)
653  set(ABSL_INTERNAL_CXX_STD_FEATURE cxx_std_20)
654elseif(ABSL_INTERNAL_AT_LEAST_CXX17)
655  set(ABSL_INTERNAL_CXX_STD_FEATURE cxx_std_17)
656else()
657  set(ABSL_INTERNAL_CXX_STD_FEATURE cxx_std_14)
658endif()
659
660function(absl_internal_dll_contains)
661  cmake_parse_arguments(ABSL_INTERNAL_DLL
662    ""
663    "OUTPUT;TARGET"
664    ""
665    ${ARGN}
666  )
667
668  STRING(REGEX REPLACE "^absl::" "" _target ${ABSL_INTERNAL_DLL_TARGET})
669
670  list(FIND
671    ABSL_INTERNAL_DLL_TARGETS
672    "${_target}"
673    _index)
674
675  if (${_index} GREATER -1)
676    set(${ABSL_INTERNAL_DLL_OUTPUT} 1 PARENT_SCOPE)
677  else()
678    set(${ABSL_INTERNAL_DLL_OUTPUT} 0 PARENT_SCOPE)
679  endif()
680endfunction()
681
682function(absl_internal_test_dll_contains)
683  cmake_parse_arguments(ABSL_INTERNAL_TEST_DLL
684    ""
685    "OUTPUT;TARGET"
686    ""
687    ${ARGN}
688  )
689
690  STRING(REGEX REPLACE "^absl::" "" _target ${ABSL_INTERNAL_TEST_DLL_TARGET})
691
692  list(FIND
693    ABSL_INTERNAL_TEST_DLL_TARGETS
694    "${_target}"
695    _index)
696
697  if (${_index} GREATER -1)
698    set(${ABSL_INTERNAL_TEST_DLL_OUTPUT} 1 PARENT_SCOPE)
699  else()
700    set(${ABSL_INTERNAL_TEST_DLL_OUTPUT} 0 PARENT_SCOPE)
701  endif()
702endfunction()
703
704function(absl_internal_dll_targets)
705  cmake_parse_arguments(ABSL_INTERNAL_DLL
706  ""
707  "OUTPUT"
708  "DEPS"
709  ${ARGN}
710  )
711
712  set(_deps "")
713  foreach(dep IN LISTS ABSL_INTERNAL_DLL_DEPS)
714    absl_internal_dll_contains(TARGET ${dep} OUTPUT _dll_contains)
715    absl_internal_test_dll_contains(TARGET ${dep} OUTPUT _test_dll_contains)
716    if (_dll_contains)
717      list(APPEND _deps abseil_dll)
718    elseif (_test_dll_contains)
719      list(APPEND _deps abseil_test_dll)
720    else()
721      list(APPEND _deps ${dep})
722    endif()
723  endforeach()
724
725  # Because we may have added the DLL multiple times
726  list(REMOVE_DUPLICATES _deps)
727  set(${ABSL_INTERNAL_DLL_OUTPUT} "${_deps}" PARENT_SCOPE)
728endfunction()
729
730function(absl_make_dll)
731  cmake_parse_arguments(ABSL_INTERNAL_MAKE_DLL
732  ""
733  "TEST"
734  ""
735  ${ARGN}
736  )
737
738  if (ABSL_INTERNAL_MAKE_DLL_TEST)
739    set(_dll "abseil_test_dll")
740    set(_dll_files ${ABSL_INTERNAL_TEST_DLL_FILES})
741    set(_dll_libs "abseil_dll" "GTest::gtest" "GTest::gmock")
742    set(_dll_compile_definitions "GTEST_LINKED_AS_SHARED_LIBRARY=1")
743    set(_dll_includes ${absl_gtest_src_dir}/googletest/include ${absl_gtest_src_dir}/googlemock/include)
744    set(_dll_consume "ABSL_CONSUME_TEST_DLL")
745    set(_dll_build "ABSL_BUILD_TEST_DLL")
746  else()
747    set(_dll "abseil_dll")
748    set(_dll_files ${ABSL_INTERNAL_DLL_FILES})
749    set(_dll_libs "")
750    set(_dll_compile_definitions "")
751    set(_dll_includes "")
752    set(_dll_consume "ABSL_CONSUME_DLL")
753    set(_dll_build "ABSL_BUILD_DLL")
754  endif()
755
756  add_library(
757    ${_dll}
758    SHARED
759      ${_dll_files}
760  )
761  target_link_libraries(
762    ${_dll}
763    PRIVATE
764      ${_dll_libs}
765      ${ABSL_DEFAULT_LINKOPTS}
766  )
767  set_property(TARGET ${_dll} PROPERTY LINKER_LANGUAGE "CXX")
768  target_include_directories(
769    ${_dll}
770    PUBLIC
771      "$<BUILD_INTERFACE:${ABSL_COMMON_INCLUDE_DIRS}>"
772      $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
773    PRIVATE
774      ${_dll_includes}
775  )
776
777  target_compile_options(
778    ${_dll}
779    PRIVATE
780      ${ABSL_DEFAULT_COPTS}
781  )
782
783  foreach(cflag ${ABSL_CC_LIB_COPTS})
784    if(${cflag} MATCHES "^(-Wno|/wd)")
785      # These flags are needed to suppress warnings that might fire in our headers.
786      set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
787    elseif(${cflag} MATCHES "^(-W|/w[1234eo])")
788      # Don't impose our warnings on others.
789    else()
790      set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
791    endif()
792  endforeach()
793  string(REPLACE ";" " " PC_LINKOPTS "${ABSL_CC_LIB_LINKOPTS}")
794
795  FILE(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc" CONTENT "\
796prefix=${CMAKE_INSTALL_PREFIX}\n\
797exec_prefix=\${prefix}\n\
798libdir=${CMAKE_INSTALL_FULL_LIBDIR}\n\
799includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR}\n\
800\n\
801Name: ${_dll}\n\
802Description: Abseil DLL library\n\
803URL: https://abseil.io/\n\
804Version: ${absl_VERSION}\n\
805Libs: -L\${libdir} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-l${_dll}> ${PC_LINKOPTS}\n\
806Cflags: -I\${includedir}${PC_CFLAGS}\n")
807  INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/${_dll}.pc"
808    DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
809
810  target_compile_definitions(
811    ${_dll}
812    PUBLIC
813      ${_dll_compile_definitions}
814    PRIVATE
815      ${_dll_build}
816      NOMINMAX
817    INTERFACE
818      ${ABSL_CC_LIB_DEFINES}
819      ${_dll_consume}
820  )
821
822  if(ABSL_PROPAGATE_CXX_STD)
823    # Abseil libraries require C++14 as the current minimum standard. When
824    # compiled with a higher minimum (either because it is the compiler's
825    # default or explicitly requested), then Abseil requires that standard.
826    target_compile_features(${_dll} PUBLIC ${ABSL_INTERNAL_CXX_STD_FEATURE})
827  endif()
828
829  install(TARGETS ${_dll} EXPORT ${PROJECT_NAME}Targets
830        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
831        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
832        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
833  )
834
835  add_library(absl::${_dll} ALIAS ${_dll})
836endfunction()
837