Add a note about how to link absl::log_flags under CMake to workaround
the lack of a feature equivalent to Bazel's alwayslink=True
PiperOrigin-RevId: 598855446
Change-Id: I0bb3bc40005908106eb7a7252572e3af153a7f5c
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 18fb75f..bd1c71b 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -80,7 +80,7 @@
# absl::fantastic_lib
# )
#
-# TODO: Implement "ALWAYSLINK"
+# TODO(b/320467376): Implement "ALWAYSLINK".
function(absl_cc_library)
cmake_parse_arguments(ABSL_CC_LIB
"DISABLE_INSTALL;PUBLIC;TESTONLY"
diff --git a/absl/log/CMakeLists.txt b/absl/log/CMakeLists.txt
index 3c61fe8..a7d8b69 100644
--- a/absl/log/CMakeLists.txt
+++ b/absl/log/CMakeLists.txt
@@ -461,6 +461,11 @@
PUBLIC
)
+# Warning: Many linkers will strip the contents of this library because its
+# symbols are only used in a global constructor. A workaround is for clients
+# to link this using $<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags> instead of
+# the plain absl::log_flags.
+# TODO(b/320467376): Implement the equivalent of Bazel's alwayslink=True.
absl_cc_library(
NAME
log_flags