Switch to CMake built-in precompiled headers (resolve #657)#659
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chipbarnaby
approved these changes
Jul 9, 2026
chipbarnaby
left a comment
Contributor
There was a problem hiding this comment.
Works for the DEBUG<->RELEASE flip back and forth use case.
Contributor
|
Also addresses #330. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #657. I believe my desktop builds now work the way you intended. This fix rewrites the PCH macro in modern CMake.
/Yc+/YuStdAfx.cpp scheme with CMake's built-intarget_precompile_headers(), which is generator- and compiler-agnostic (Ninja, MSBuild, GCC/Clang).Background
The built-in support force-includes
cnglob.hinto every translation unit in addition to each source's own#include "cnglob.h". Becausecnglob.hlacked an include guard, this double inclusion caused many redefinition errors. The old/Yu"cnglob.h"scheme masked this because MSVC discards all source text up to and including the#include "cnglob.h"line, so the header was only processed once.Changes
target_precompile_headers()addMSVCPrecompiledHeadermacro andStdAfx.cppprecomp entry; addtarget_precompile_headers(CSE PRIVATE "cnglob.h")#ifndef GLOBinclude guard (the symbol the file's own comment already anticipated) to make the header idempotent🤖 Generated with Claude Code