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