cmake: define WIN32_LEAN_AND_MEAN for examples#18232
Closed
vszakats wants to merge 3 commits intocurl:masterfrom
Closed
cmake: define WIN32_LEAN_AND_MEAN for examples#18232vszakats wants to merge 3 commits intocurl:masterfrom
WIN32_LEAN_AND_MEAN for examples#18232vszakats wants to merge 3 commits intocurl:masterfrom
Conversation
To make build faster. Also syncing with autotools. This also happens to fix what looks like a Windows SDK header bug seen in VS2019 on AppVeyor CI: ``` C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h(1422,1): error C2220: the following warning is treated as an error (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h(1422,1): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winioctl.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\windows.h(254,17): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winscard.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winsock2.h(4221,1): warning C5031: #pragma warning(pop): likely mismatch, popping warning state pushed in different file (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\windows.h : message : #pragma warning(push) (compiling source file C:\projects\curl\docs\examples\block_ip.c) C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winsock2.h : warning C5032: detected #pragma warning(push) with no corresponding #pragma warning(pop) (compiling source file C:\projects\curl\docs\examples\block_ip.c) ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/52531106/job/66b6r098pll2le70#L312
vszakats
added a commit
that referenced
this pull request
Aug 9, 2025
In CI we want to ensure that examples build cleanly, but we don't want to actually run them there. Meaning it's enough to just compile, but not link them in CI. Saving time up to 2-4x (MSVC), and disk space up to 1.2GB (or 8-70x). Add a new cmake target that compiles all examples without linking them into runnable binaries. Keep a full build for a single example to test if it links correctly. Also: - CI: switch over all `curl-examples` targets to `curl-examples-build` - GHA/linux-old: build examples in one of the cmake builds. Result highlights: Job | Bef. | Bef. | Aft. | Aft. | :------------------ | ---: | ----: | ---: |----: | cygwin | 15s | 9MB | 10s | 1MB | msys | 13s | 8MB | 7s | 1MB | dl-mingw 15 | 39s | 113M | 34s | 2MB | dl-mingw 9.5.0 | 49s | 115MB | 42s | 2MB | dl-mingw 7.3.0 | 19s | 113MB | 14s | 2MB | dl-mingw 6.4.0 | 9s | 12MB | 7s | 4MB | Linux cross | 19s | 28MB | 19s | 2MB | MSVC UWP | 65s | 374MB | 9s | 17MB | MSVC x64 | 22s | 846MB | 9s | 17MB | VS2010 | 48s | 105MB | 15s | 9MB | VS2022 clang-cl | 195s | 1.2GB | 51s | 20MB | iOS Xcode | 8s | | 5s | | macOS LibreSSL | 16s | | 11s | | Linux aws-lc | 3s | | 1s | | Follow-up to dda251e #18232 Closes #18209
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To build faster. Also syncing with autotools.
It also happens to fix what looks like a Windows SDK header bug seen
with VS2019 on AppVeyor CI:
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/52531106/job/66b6r098pll2le70#L312