Skip to content

cmake: optionally generate tweakme header - #3647

Open
fyrsta7 wants to merge 1 commit into
gabime:v1.xfrom
fyrsta7:cmake/generated-tweakme-header
Open

cmake: optionally generate tweakme header#3647
fyrsta7 wants to merge 1 commit into
gabime:v1.xfrom
fyrsta7:cmake/generated-tweakme-header

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 24, 2026

Copy link
Copy Markdown

Fixes #3077.

Motivation

Several spdlog build options are represented both as CMake target definitions
and as settings in tweakme.h. Consumers that do not use the exported CMake or
pkg-config metadata cannot recover the configuration used to build an
installed spdlog library and currently need downstream patches to the header.

Solution

Add an opt-in SPDLOG_GENERATE_TWEAKME_H CMake option, disabled by default.
When enabled, CMake generates include/spdlog/tweakme.h from the existing
spdlog configuration options. Source-tree compiled and header-only targets use
the generated header, and installation selects it in place of the editable
source header.

When generation is disabled, the existing source header and installation
behavior are unchanged. The option does not change the existing exported
target definitions, C++11 support, or pkg-config metadata.

Validation

The CMake integration test covers source-tree and installed consumers for both
compiled and header-only targets, static and shared builds, and a raw installed
header-only consumer that does not use a spdlog CMake target or pkg-config
metadata. It also checks that generated-header include precedence is effective.

The default and generated configurations both pass the official compiled and
header-only test suites. Static and shared C++11 source-tree consumers,
installed package consumers, and the raw installed-header consumer pass
locally. I also verified separately that a default installation produces a
tweakme.h byte-for-byte identical to the source header. The nested host-run
integration test is omitted while cross-compiling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto generate tweakme.h

1 participant