Skip to content

Commit

Permalink
Add a note about how to link absl::log_flags under CMake to workaround
Browse files Browse the repository at this point in the history
the lack of a feature equivalent to Bazel's alwayslink=True

PiperOrigin-RevId: 598855446
Change-Id: I0bb3bc40005908106eb7a7252572e3af153a7f5c
  • Loading branch information
derekmauro authored and copybara-github committed Jan 16, 2024
1 parent b2dd3a5 commit 10f3e61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMake/AbseilHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ endif()
# 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"
Expand Down
5 changes: 5 additions & 0 deletions absl/log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ absl_cc_library(
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
Expand Down

0 comments on commit 10f3e61

Please sign in to comment.