cmake: fix Windows build support

On Windows, shared libraries (DLLs) require an import library (.lib)
for linking, and the DLL itself is placed in bin/ rather than lib/ by
the Zig build. The CMake wrapper was missing IMPORTED_IMPLIB on the
shared imported target, causing link failures, and assumed the shared
library was always in lib/.

Add GHOSTTY_VT_IMPLIB for the import library name, set IMPORTED_IMPLIB
on the ghostty-vt target, and fix the shared library path to use bin/
on Windows. Install the DLL and PDB to bin/ and the import library to
lib/ following standard Windows conventions. Apply the same fixes to
ghostty-vt-config.cmake.in for the find_package path.
This commit is contained in:
Mitchell Hashimoto
2026-03-22 13:34:09 -07:00
parent fa10237fb0
commit 5a46e61bee
3 changed files with 55 additions and 6 deletions

View File

@@ -87,6 +87,7 @@ jobs:
- build-dist
- build-examples-zig
- build-examples-cmake
- build-examples-cmake-windows
- build-cmake
- build-flatpak
- build-libghostty-vt
@@ -263,6 +264,30 @@ jobs:
nix develop -c cmake -B build -DFETCHCONTENT_SOURCE_DIR_GHOSTTY=${{ github.workspace }}
nix develop -c cmake --build build
build-examples-cmake-windows:
strategy:
fail-fast: false
matrix:
dir: ${{ fromJSON(needs.list-examples.outputs.cmake) }}
name: Example ${{ matrix.dir }} (Windows)
runs-on: windows-2025
continue-on-error: true
timeout-minutes: 45
needs: [test, list-examples]
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
- name: Build Example
shell: pwsh
run: |
cd example/${{ matrix.dir }}
cmake -B build -DFETCHCONTENT_SOURCE_DIR_GHOSTTY=${{ github.workspace }}
cmake --build build
build-cmake:
runs-on: namespace-profile-ghostty-sm
needs: test