Skip to content

cmake: add import library to custom command OUTPUT#11794

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
deblasis:fix/cmake-implib-output
Mar 24, 2026
Merged

cmake: add import library to custom command OUTPUT#11794
mitchellh merged 1 commit into
ghostty-org:mainfrom
deblasis:fix/cmake-implib-output

Conversation

@deblasis
Copy link
Copy Markdown
Contributor

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_command
that 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

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 mitchellh added this to the 1.4.0 milestone 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>
@mitchellh mitchellh merged commit d4a38c8 into ghostty-org:main Mar 24, 2026
80 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants