msquic icon indicating copy to clipboard operation
msquic copied to clipboard

Static build is not compatible with CMAKE_DEBUG_POSTFIX

Open j-schultz opened this issue 1 month ago • 1 comments

Describe the bug

On Windows, trying to build a static version of the msquic library (using QUIC_BUILD_SHARED=ON) fails if the CMAKE_DEBUG_POSTFIX isn't empty. The library is actually built with the postfix (obj\Debug\msquic_staticd.lib is built), but then later on, the linker tries to access a file without the suffix:

LINK : fatal error LNK1181: cannot open input file '...\msquic-build\obj\Debug\msquic_static.lib'

So it looks like the msquic CMake generates the filename somewhere without taking the CMAKE_<CONFIG>_POSTFIX into account. It should either do that, use a generator pattern to retrieve the actual filename from the target.

Affected OS

  • [x] Windows
  • [ ] Linux
  • [ ] macOS
  • [ ] Other (specify below)

Additional OS information

No response

MsQuic version

v2.5

Steps taken to reproduce bug

Build a Debug configuration with QUIC_BUILD_SHARED=ON, CMAKE_DEBUG_POSTFIX=d

Expected behavior

The build should success and use the file with the correct filename postfix.

Actual outcome

Build fails in linking step as described above.

Additional details

No response

j-schultz avatar Nov 07 '25 11:11 j-schultz

Hi, thanks for reporting this! It might take a bit before we can get to it, but in the meantime a PR is welcome if you feel like fixing it.

guhetier avatar Nov 11 '25 19:11 guhetier

Hi, I’m trying to build a static version of msquic on Windows, and I also ran into this issue with CMAKE_DEBUG_POSTFIX. I traced it to the msquic_static target in src/bin/CMakeLists.txt, which does not use OUTPUT_NAME like the main msquic library. I think setting OUTPUT_NAME for msquic_static might fix the linking error with the debug postfix. I’m happy to try a small patch if that’s helpful.

Maiyu27 avatar Dec 13 '25 09:12 Maiyu27