Skip to content

Commit

Permalink
PR #1715: Generate options.h using CMake only once
Browse files Browse the repository at this point in the history
Imported from GitHub PR #1715

Using abseil via CMake ExternalProject, for each compilation abseil is reconfigured. This leads to a new options-pinned.h generated and then a new options.h installed. Because of that new options.h file, all projects depending on abseil recompile entirely.

Using file(GENERATE ...) instead of file(WRITE ...) allows generating options-pinned.h only when the content is new or changed.

Merge b3b5386 into cd75cb4

Merging this change closes #1715

COPYBARA_INTEGRATE_REVIEW=#1715 from BotellaA:patch-1 b3b5386
PiperOrigin-RevId: 652495570
Change-Id: Ib14bd9a78f80a540aae73d7a94cb46e2c05e8509
  • Loading branch information
BotellaA authored and copybara-github committed Jul 15, 2024
1 parent b86d574 commit 646126a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ if(ABSL_ENABLE_INSTALL)
ABSL_INTERNAL_OPTIONS_H_PINNED
"${ABSL_INTERNAL_OPTIONS_H_CONTENTS}")

file(WRITE "${CMAKE_BINARY_DIR}/options-pinned.h" "${ABSL_INTERNAL_OPTIONS_H_PINNED}")
file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/options-pinned.h" CONTENT "${ABSL_INTERNAL_OPTIONS_H_PINNED}")

install(FILES "${CMAKE_BINARY_DIR}/options-pinned.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/absl/base
Expand Down

0 comments on commit 646126a

Please sign in to comment.