Summary
cmake/patches/apply_patch_toml.sh prints four error: lines on every fresh configure, even though everything works correctly:
[ 44%] Performing patch step for 'tomlplusplus-populate'
error: patch failed: include/toml++/impl/make_node.h:134
error: include/toml++/impl/make_node.h: patch does not apply
error: patch failed: CMakeLists.txt:31
error: CMakeLists.txt: patch does not apply
Cause
The script answers the question "was the patch already applied?" by attempting a reverse apply:
if ! git apply -R --ignore-whitespace ${TOML_PATCH} --check; then git apply --ignore-whitespace ${TOML_PATCH}; fi
git apply -R --check fails loudly when the patch is not yet applied — which is the normal case on every fresh FetchContent clone. The errors come from the probe, not from the actual application (which succeeds silently right after). Downstream consumers see scary patch does not apply errors in otherwise green build logs (we hit this building RediSearch → VectorSimilarity → SVS, and spent time confirming the patch was in fact applied).
Suggested fix
Probe the state instead of reverse-applying — the TOMLPLUSPLUS_INSTALL option that the patch itself adds to CMakeLists.txt is proof of appliedness:
if ! grep -q TOMLPLUSPLUS_INSTALL CMakeLists.txt; then git apply --ignore-whitespace ${TOML_PATCH}; fi
- Same idempotence for CMake re-configures (the case the script guards against, per the comment in
cmake/toml.cmake).
- Nothing is silenced: the real
git apply keeps its stderr, so a genuinely failing patch still surfaces.
- Verified against a fresh
marzer/tomlplusplus clone at v3.3.0: first run applies the patch with zero output, second run skips with zero output.
Happy to open a PR if you'd take one.
Summary
cmake/patches/apply_patch_toml.shprints fourerror:lines on every fresh configure, even though everything works correctly:Cause
The script answers the question "was the patch already applied?" by attempting a reverse apply:
git apply -R --checkfails loudly when the patch is not yet applied — which is the normal case on every fresh FetchContent clone. The errors come from the probe, not from the actual application (which succeeds silently right after). Downstream consumers see scarypatch does not applyerrors in otherwise green build logs (we hit this building RediSearch → VectorSimilarity → SVS, and spent time confirming the patch was in fact applied).Suggested fix
Probe the state instead of reverse-applying — the
TOMLPLUSPLUS_INSTALLoption that the patch itself adds toCMakeLists.txtis proof of appliedness:cmake/toml.cmake).git applykeeps its stderr, so a genuinely failing patch still surfaces.marzer/tomlplusplusclone atv3.3.0: first run applies the patch with zero output, second run skips with zero output.Happy to open a PR if you'd take one.