Generate options.h using CMake only once

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.
This commit is contained in:
Arnaud Botella
2024-07-13 15:29:10 +02:00
committed by GitHub
parent cd75cb4ae3
commit b3b53860d1

View File

@@ -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