Skip to content

Fix Windows CI build failure and improve build speed - #404

Merged
PJK merged 2 commits into
masterfrom
fix-windows-ci
Feb 9, 2026
Merged

PJK merged 2 commits into
masterfrom
fix-windows-ci

Conversation

@PJK

@PJK PJK commented Feb 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix build failure: Add _CRT_SECURE_NO_WARNINGS to the cbor_project_options INTERFACE library so examples and tests don't fail with MSVC C4996 errors when /sdl is active (sscanf, freopen, fopen usages in examples)
  • Restrict LTO to Release only: Use CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE instead of CMAKE_INTERPROCEDURAL_OPTIMIZATION to avoid unnecessary LTCG overhead in Debug builds
  • Parallelize Windows CI: Add --parallel to cmake --build commands

Context

The Windows CI failure was introduced in #402 when add_definitions(-D_CRT_SECURE_NO_WARNINGS) (global) was replaced with target_compile_definitions(cbor PRIVATE _CRT_SECURE_NO_WARNINGS) (library-only). The /sdl flag from cbor_project_options turns C4996 deprecation warnings into errors for example targets that use standard CRT functions.

Test plan

  • Windows CI (build-and-test-win) passes
  • Linux/macOS CI passes (no LTO in Debug, LTO in Release)

🤖 Generated with Claude Code

PJK and others added 2 commits February 9, 2026 01:17
- Add _CRT_SECURE_NO_WARNINGS to cbor_project_options INTERFACE library
  so examples/tests don't fail with C4996 errors from /sdl (sscanf,
  freopen, fopen)
- Restrict LTO to Release builds only (CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE)
  to avoid unnecessary LTCG overhead in Debug
- Add --parallel to cmake --build on Windows CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Feb 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (190a9c1) to head (04992a3).
⚠️ Report is 19 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master      #404      +/-   ##
===========================================
+ Coverage   99.87%   100.00%   +0.12%     
===========================================
  Files          20        20              
  Lines        1663      1663              
===========================================
+ Hits         1661      1663       +2     
+ Misses          2         0       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PJK
PJK merged commit 0a54bbb into master Feb 9, 2026
18 checks passed
@PJK
PJK deleted the fix-windows-ci branch February 9, 2026 00:26
PJK added a commit that referenced this pull request Feb 15, 2026
* Fix Windows CI build failure and improve build speed

- Add _CRT_SECURE_NO_WARNINGS to cbor_project_options INTERFACE library
  so examples/tests don't fail with C4996 errors from /sdl (sscanf,
  freopen, fopen)
- Restrict LTO to Release builds only (CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE)
  to avoid unnecessary LTCG overhead in Debug
- Add --parallel to cmake --build on Windows CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Link PR #404 in changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add Windows Defender exclusion to speed up Windows CI

Add-MpExclusion for the project directory to prevent real-time
scanning overhead during cmake configure and build steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Try multiple approaches to disable Defender (best-effort)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Cache cmocka build on Windows CI

The cmocka configure step takes ~206s on MSVC due to each
check_function_exists call spawning cl.exe with high startup overhead.
Cache the build so it's only paid once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Switch Windows CI to Ninja generator

Use Ninja instead of VS generator to speed up configure (no .vcxproj
generation, faster trial compilations) and build steps. Uses vswhere
to locate vcvarsall.bat, writes batch scripts from bash to avoid
quoting issues across shells.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Escape heredoc << for CircleCI v2.1 config parser

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove accidentally committed build artifacts and local files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址