cmake: add import library to custom command OUTPUT#11794
Merged
Conversation
Ninja requires all produced files to be listed as explicit outputs of custom commands. The zig build produces a .lib import library alongside the DLL, but it was not listed in the OUTPUT directive. This causes Ninja to fail with "missing and no known rule to make it" when IMPORTED_IMPLIB references the .lib file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mitchellh
approved these changes
Mar 24, 2026
deblasis
added a commit
to deblasis/winghostling
that referenced
this pull request
Mar 24, 2026
Add Windows platform support to ghostling using the ConPTY API for pseudo-terminal emulation. The implementation lives entirely in main.c alongside the existing Unix code, gated by #ifdef _WIN32. Key changes: - ConPTY-based pty spawning with shell auto-detection (pwsh > powershell > cmd) - Threaded pipe reader for ConPTY output (PeekNamedPipe is unreliable) - --shell <path> flag for explicit shell selection on all platforms - GUI subsystem build to prevent console window on Windows - Windows CI job on windows-latest - Bump ghostty to include import-lib OUTPUT fix (ghostty-org/ghostty#11794) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
deblasis
added a commit
to deblasis/winghostling
that referenced
this pull request
Mar 24, 2026
Add Windows platform support to ghostling using the ConPTY API for pseudo-terminal emulation. The implementation lives entirely in main.c alongside the existing Unix code, gated by #ifdef _WIN32. Key changes: - ConPTY-based pty spawning with shell auto-detection (pwsh > powershell > cmd) - Threaded pipe reader for ConPTY output (PeekNamedPipe is unreliable) - --shell <path> flag for explicit shell selection on all platforms - GUI subsystem build to prevent console window on Windows - Windows CI job on windows-latest - Bump ghostty to include import-lib OUTPUT fix (ghostty-org/ghostty#11794) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
deblasis
added a commit
to deblasis/winghostling
that referenced
this pull request
Mar 24, 2026
Add Windows platform support to ghostling using the ConPTY API for pseudo-terminal emulation. The implementation lives entirely in main.c alongside the existing Unix code, gated by #ifdef _WIN32. Key changes: - ConPTY-based pty spawning with shell auto-detection (pwsh > powershell > cmd) - Threaded pipe reader for ConPTY output (PeekNamedPipe is unreliable) - --shell <path> flag for explicit shell selection on all platforms - GUI subsystem build to prevent console window on Windows - Windows CI job on windows-latest - Bump ghostty to include import-lib OUTPUT fix (ghostty-org/ghostty#11794) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
What
PR #11756 added IMPORTED_IMPLIB pointing to the .lib import library, but the
import library is not listed in the OUTPUT directive of the
add_custom_commandthat runs zig build. The file is produced as a side-effect of the build.
This works with the Visual Studio generator (which is lenient about undeclared outputs) but fails with Ninja:
ninja: error: 'zig-out/lib/ghostty-vt.lib', needed by 'ghostling', missing and no known rule to make it
The fix adds "${ZIG_OUT_DIR}/lib/${GHOSTTY_VT_IMPLIB}" to the OUTPUT list. No
behavioral change. The file was already being built, Ninja just needs to know
about it.
but_why.gif
I am cleaning up ghostty-org/ghostling#6 and I realise that in order to get rid of the CMake workarounds we had before #11756, this change is necessary.
POC
I set up a branch pointing at my fork with a POC and it builds, this is the cleaned up CMakeList https://github.com/deblasis/winghostling/blob/test/cmake-implib-no-workaround/CMakeLists.txt