Static build is not compatible with CMAKE_DEBUG_POSTFIX
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
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.
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.